Thursday, March 31, 2016

Overlay Screen on Visualforce Page without any CSS or Plugin

Hi All,

My todays post is related to the standard solution for Overlay Screen, I have suffered a lot whenever I got some implementation for the Overlay screen because I did that with CSS and so many things to remember and apply in this. Recently I have found a standard solution for the Overlay screen , which is not required to apply any CSS and no headache to apply the validation and Error message from Apex; we could do that through simple javascript functions.

Take an Example: Here I have a button, which will trigger a javascript function to display the popup screen.


Onclick of the button, we will get a overlay screen like the given snapshot.


We could bind the inputtext or inputfields as well in case we need to accept some picklist or lookup values etc.  Onchange of the textboxes we could validate the value and assign in a javascript variable. Onclick of Ok button it will call a javascript function which will validate the values and call actionfunction to perform the logic in apex controller. Onclick of cancel it will simply close the overlay screen. The performance is better and faster in comparison to custom overlay screen.

When you will press ok, you could see a message for success of the logic like in the image given below.


Check the code below:
Visualforce Page:


Apex Controller:


Hope this will be helpful for you.  Happy Coding J

Feel free to contact if you have anything in which I could help you.

Thanks,
Amit Goyal
Skype: amitgoyal09

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.