Sign In Register

How can we help you today?

Start a new topic

Dynamic Forms - Popup Example

We had a recent question about how to do this, so we've turn this into a mini tutorial...

So first of all i have a snippet with an button where i can call this popup modal. Here we send the variable action=view to the popup_example snippet when the button is pressed.

<gs-link snippet="popup_example?action=view" target="modal-small">
    <button>Show Popup</button>

Then in the snippet called 'popup_example' we use that variable to let the popup snippet know when to show the popup and when to go back to the last screen.

So, going through whats going on here in steps for this snippet...

1 Comment

  1. we sent action=view from the previous screen, so we can check this in a switch-case to see if we should view or exit the popup.
  2. If there is other data you want to send with the form you can do that in the view method.
  3. In html we use handlebars to check if 'exit' was sent in the form, and if not we draw a simple title with some text and a button.
  4. the button triggers the same snippet, only this time we pass in the action=exit, and the target is our original placeholder screen.
  5. now the snippet runs again, only instead of view, we'll run the exit method which adds the exit variable to the form.
  6. Now when we run the html we close the modal and bring up the last screen again.


Login to post a comment