[SalesForce] Conditional Pop up on visualforce page

How can I dynamically display a popup, based on a checkbox, on a page when it loads?


  • Application Object
    • Field – testchk which is a checkBox field.

When the Visualforce page loads, if testchk checkbox is not checked in the queried application, then display pop up with a checkbox and submit button. Else display the page.

Best Answer

If you are writing javascript code directly on VF page in you can do something like: Write it in end of your VF page.


if({!myObjectReference.myField}) // return true or false, also try {!myObjectReference.myField == true}
   dsplayPage(); // or do nothing
  displayPopup(); // popup logic is in this method

To show a popup Jquery modal dialogue can be helpful also here you can find required popup to show and its implementation.

Related Topic