Visual Composer Conditional Pop Ups 7.0
This document focuses on explaining how to trigger pop ups based on a condition in drop down or on click of a button
The document will be helpful for all VC developers working on VC 7.0 and above.
3. Problem Statement:
The requirement was to open a pop up on selection of a particular value from a drop down.
For e.g. : Let’s say there is a drop down with values “A”,”B” and “C”.
So when the user chooses the value “B” he should be shown a pop up with certain text and a button, something similar to this
This is not a pop up technically and only a form which gets displayed on fulfillment of the conditions.
2. The Proposed Solution
- Inside the parent iView/Layer create another form view (that would serve as the pop up).
- Now from the Form(where the drop down exists on selection of whose value, pop up needs to be triggered) draw an event from the “out” till a data store.
- Name this event as some Custom Action like “openpopup”.
4. Inside the data store maintain some Boolean variable for e.g”ZConf” in this case and assign this Boolean variable, value on this event “OpenPopUp”.
- From the “out” of the form view which will be used as the pop up draw a custom event e.g”hidepopup” till the data store.
- If you want to close your pop up on click of a button,assign this custom action “hidepopup” to your button.
- On this event “hidepopup” assign the boolean variable “False” so that the pop up closes on click of the “Close” button.
On the visibility condition of this pop up put the following formula so that the pop up appears only when a specific condition is met.