+ Start a Discussion
SalesforceLearnerNewbieSalesforceLearnerNewbie 

hovering mouse does not show the information initialized in controller

I have a button created and I wish to have a function where user could just hover to the button and then it will pop up a small window showing the information(String) that I have initialized in the controller.


VF page:

                        <a href="/{!showing}" id="aa" onblur="LookupHoverDetail.getHover('aa').hide();" onfocus="LookupHoverDetail.getHover('aa', '/{!showing}/m?retURL=%2F{!showing}&isAjaxRequest=1').show();" onmouseout="LookupHoverDetail.getHover('aa').hide();" onmouseover="LookupHoverDetail.getHover('aa', '/{!showing}/m?retURL=%2F{!showing}&isAjaxRequest=1').show();">

                            <apex:commandButton value="submit" action="{!submit}" style=""/>

</a>

 

Controller:

public with sharing class toshow{

public String showing {get;set;}

public toshow{
     showing = 'I just want to show information';
}
}

I tried this but it just load and then nothing shown, the small window dissappeared after loading. Can anyone assist me?

 

Best Answer chosen by SalesforceLearnerNewbie
Parmanand PathakParmanand Pathak
Try below code its working for me - 

Use html button instead of using apex:commandbutton.
public with sharing class PopupTest 
{  
    public String showing {get;set;}
    
    public PopupTest()
    {
        showing = 'I just want to show information';
    }
}
<apex:page controller="PopupTest">
<style>
.tooltip {
  position: relative;
  display: inline-block;
  border-bottom: 1px dotted black;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 320px;
  background-color: #555;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px 0;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -160px;
  opacity: 0;
  transition: opacity 0.3s;
}

.tooltip .tooltiptext::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #555 transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}
</style>
<body style="text-align:center;">
<br /><br /><br /><br />
<button class="tooltip">Show Popup<span class="tooltiptext">{!showing}</span></button>
</body>
</apex:page>

Let me know if it helps you or not.


Thanks,,
Parmanand Pathak

 

All Answers

Parmanand PathakParmanand Pathak
Try below code its working for me - 

Use html button instead of using apex:commandbutton.
public with sharing class PopupTest 
{  
    public String showing {get;set;}
    
    public PopupTest()
    {
        showing = 'I just want to show information';
    }
}
<apex:page controller="PopupTest">
<style>
.tooltip {
  position: relative;
  display: inline-block;
  border-bottom: 1px dotted black;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 320px;
  background-color: #555;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px 0;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -160px;
  opacity: 0;
  transition: opacity 0.3s;
}

.tooltip .tooltiptext::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #555 transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}
</style>
<body style="text-align:center;">
<br /><br /><br /><br />
<button class="tooltip">Show Popup<span class="tooltiptext">{!showing}</span></button>
</body>
</apex:page>

Let me know if it helps you or not.


Thanks,,
Parmanand Pathak

 
This was selected as the best answer
SalesforceLearnerNewbieSalesforceLearnerNewbie
Thank you and this helps. I would like to ask why my vf page when I put it on Site for public to access, there is no login button to salesforce? My controller will need to pass the information to the user personal task. Without login, there is no way to pass the information to their account task object, right?