Description
Adds a Show as Popup checkbox to HTML fields in the form editor. When conditional logic shows a popup-enabled HTML field after user interaction, its content opens in an accessible modal instead of inline on the form.
Usage Notes
- Enable Show this HTML field as a popup when visible on an HTML field (Advanced tab), then configure conditional logic on that field so it is shown when the desired rule matches.
- Single PHP block — frontend JS and CSS are inlined via
wp_add_inline_scriptandwp_add_inline_styleon forms that contain at least one popup HTML field. - The popup opens when conditional logic shows the field after user interaction — not on initial page load.
- Popup HTML is inserted via
innerHTML; only place trusted content in HTML fields used as popups. - Default modal styling is minimal; adjust the CSS in
gf_html_popup_get_frontend_styles()to match your theme. - The form editor setting uses jQuery (Gravity Forms editor API). Frontend modal behavior uses vanilla DOM only.
Code
Please log in to view this code snippet.