function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
pradyprady 

Show two buttons on mouseover of commandbutton

Hi,

 

I want to clone a record with two options

1. one with line items

2. without lineitems

 

I have a button in my VF page on mouse over i need something like a dropdown menu 1. clone with line items, 2. clone without line items.

 

Is that possible?

 

The  simplest option would be to have two buttons "clone with lineitems" and "clone without lineitems". But would like to explore the possibility of having it on hover.

 

Can anybody come up with ideas/suggestions to achieve it?

 

Thanks

Prady

Best Answer chosen by Admin (Salesforce Developers) 
AvromAvrom

So, my inclination would be to put your two options (as, say, commandLinks) in a <div> tag with an id and style="display: none". Then, you could add an onMouseOver JS event on your button to unhide the div, and maybe change the x-position and y-position appropriately. Remember to add an onMouseOut, too, to re-hide it.

 

All Answers

AvromAvrom

So, my inclination would be to put your two options (as, say, commandLinks) in a <div> tag with an id and style="display: none". Then, you could add an onMouseOver JS event on your button to unhide the div, and maybe change the x-position and y-position appropriately. Remember to add an onMouseOut, too, to re-hide it.

 

This was selected as the best answer
pradyprady

Thanks.... It worked like a charm. The only other thing which i did was have a mouseout on the div otherwise by the time i tried to access the div, it would turn off as the mouseout of the button would be active. So i removed the mouse out from the button to the div

DevNVDevNV

Would love to see your VF code for this button, for those of us not as versed in JS code and CSS.

 

Thanks!