Home › Toolset Professional Support › [Resolved] Forms conditional groups not working in Elementor popup
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | - |
- | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | 14:00 – 18:00 | 13:00 – 18:00 | - |
Supporter timezone: America/Jamaica (GMT-05:00)
Tagged: Toolset Forms
This topic contains 17 replies, has 3 voices.
Last updated by Shane 4 years, 1 month ago.
Assisted by: Shane.
I have a page built in Elementor that includes a Toolset Form widget. The form uses conditional logic to show/hide a field group, and everything works perfectly.
I would like to include this same form in an Elementor Popup, but if I place the same Toolset Form widget in a popup, the conditional fields no longer function.
Is this a known issue and is there any workaround?
Hi, I'm not aware of a known issue with Elementor popups but I'll be glad to take a look and see if there's something we can do to fix the problem. As a quick test, is it possible to place the same Form on a page where the popup will be displayed, then test the Form in the popup over this page? I'm curious to see if placing the Form on the page when the page loads will result in loading the correct scripts and assets for the popup Form.
Please let me know the results of this test on your site, and I can try to set up a similar test in a local environment. Then we can compare results to see if the problem is replicable on my site or exclusive to your site somehow. Let me know what you find out and we can go from there.
Hi Christian. Yes, I have tried placing an instance of the form on the same page as the popup. The conditional logic functions properly on the page, but not in the popup.
Try placing any form with conditional logic in an Elementor pop-up to see if it works in your environment. I am using the pop-ups that are built-in to Elementor Pro, and the Astra theme, if that makes a difference.
Also of note, on some forms I can see shortcodes (or portions of shortcodes) rendered on screen when working in the Elementor editor. It's only visible in the editor, and the forms render and work fine on the front end, but it does make wonder if it's causing problems. I've attached a screenshot of the pop-up in question, both in the editor and the front end. The form requires a user to be logged in to view, but I can provide you with a login if you like.
Here is the code for my form, in case you spot any errors:
[credform] <div class="container-fluid"> <div class="row"> <div class="form-group col-sm-12"> <h4 style="font-family: Roboto Slab; font-weight: 600; padding-bottom: 10px;">Hi, [wpv-user field="user_firstname"]. How can I help you?</h4> [cred_field field='message-to-agent' force_type='field' class='form-control' output='bootstrap' placeholder='Type your message here'] </div> </div> <div class="row"> <div class="form-group col-sm-7"> <label>How should I reply to you?</label> [cred_field field='contact-methods' force_type='field' class='form-control' output='bootstrap'] </div> <div class="col-sm-5"> <div class="row"> <div class="form-group col-sm-12"> [cred_show_group if="( $(contact-methods) eq 'Text' ) OR ( $(contact-methods) eq 'Phone' )" mode="slide"] <label>Phone</label> [cred_field field='lead-phone' force_type='field' class='form-control' output='bootstrap' value='[types usermeta="user-phone" current_user="true"][/types]' placeholder='000-000-0000'] [/cred_show_group] </div> </div> </div> </div> <div class="hidden-fields"> <div class="row"> <div class="form-group col-sm-6"> <label>First Name</label> [cred_field field='first-name' force_type='field' class='form-control' output='bootstrap' value='[wpv-user field="user_firstname"]'] </div> <div class="form-group col-sm-6"> <label>Last Name</label> [cred_field field='last-name' force_type='field' class='form-control' output='bootstrap' value='[wpv-user field="user_lastname"]'] </div> </div> <div class="row"> <div class="form-group col-sm-12"> <label>Lead Email</label> [cred_field field='email' force_type='field' class='form-control' output='bootstrap' value='[wpv-user field="user_email"]'] </div> </div> <div class="row"> <div class="form-group col-sm-6"> <label>Listing Title</label> [cred_field field='listing-title' force_type='field' class='form-control' output='bootstrap' value='[wpv-post-title id="$current_page]'] </div> <div class="form-group col-sm-6"> <label>Listing URL</label> [cred_field field='listing-url' force_type='field' class='form-control' output='bootstrap' value='[wpv-post-url id="$current_page]'] </div> </div> <div class="row"> <div class="form-group col-sm-6"> <label>Agent Name</label> [cred_field field='agent-name' force_type='field' class='form-control' output='bootstrap' value='[wpv-post-author meta="user_firstname" format="meta"] [wpv-post-author meta="user_lastname" format="meta"]'] </div> <div class="form-group col-sm-6"> <label>Agent Email Address</label> [cred_field field='agent-email-address' force_type='field' class='form-control' output='bootstrap' value='[wpv-post-author format="meta" meta="user_email"]'] </div> </div> </div> <div class="row"> <div class="col-sm-12"> [cred_field field='form_messages' class='alert alert-warning'] </div> </div> <div class="row"> <div class="col-sm-12"> [cred_field field='form_submit' output='bootstrap' value='Send Message' class='btn btn-primary btn-lg'] </div> </div> </div> [/credform]
In my local test, the same conditional group syntax seems to work well in a popup. I noticed that the phone field uses a Types field shortcode in its value attribute. I suggest using the output="raw" attribute to prevent problems with additional markup:
[cred_field field='lead-phone' force_type='field' class='form-control' output='bootstrap' value='[types usermeta="user-phone" current_user="true" output="raw"][/types]' placeholder='000-000-0000']
Please try that first and see if it solves the problem. If not, can you give me more information about the Form? Is this a create or edit Post Form, or a create/edit User Form? If you select "Text" in the popup and then unselect it, does the phone field disappear or stay visible?
I tried adding the "raw" attribute per your suggestion, but no change. The form creates a new Post. When you select either the "Phone" or "Text" checkboxes, the phone field should appear. I placed the form both in a popup and the page to test, both with the Toolset Form Elementor widget. It works fine on the page, but not within the popup. There are also some shortcodes that appear within the form in editor view. Here is a screen recording to show what is happening:
hidden link
Also, about the "raw" attribute.... should I use raw output whenever I use a shortcode as a value?
Also, about the "raw" attribute.... should I use raw output whenever I use a shortcode as a value?
Yes, as a general rule you should always use the output="raw" attribute/value pair in a Types field shortcode any time you place that shortcode as the value of another shortcode attribute.
Other Toolset shortcodes, Views shortcodes for example, may not support the output="raw" attribute value pair. Consult the documentation for those shortcodes on a case-by-case basis.
You're missing the closing double quote after $current_page in the listing title and listing URL shortcodes:
[cred_field field='listing-title' force_type='field' class='form-control' output='bootstrap' value='[wpv-post-title id="$current_page]']
If adding these two missing double quotes and adding output="raw" to the phone User field doesn't solve the problem in the popup Form, let's try to rule out any other syntax errors we may have overlooked. Please copy the current form contents and paste them in a raw text editor file as a backup, then replace the current Form contents with this trimmed-down version:
[credform] [cred_field field='contact-methods' force_type='field' class='form-control' output='bootstrap'] [cred_show_group if="( $(contact-methods) eq 'Text' ) OR ( $(contact-methods) eq 'Phone' )" mode="slide"] <label>Phone</label> [cred_field field='lead-phone' force_type='field' class='form-control' output='bootstrap' value='[types usermeta="user-phone" current_user="true" output="raw"][/types]' placeholder='000-000-0000'] [/cred_show_group] [cred_field field='form_messages' class='alert alert-warning'] [cred_field field='form_submit' output='bootstrap' value='Send Message' class='btn btn-primary btn-lg'] [/credform]
Test again. If the problem is resolved, add the other Form contents a bit at a time until the problem returns. This iterative approach should help you find the offending code - it's probably something deceptively simple like missing or extra quotation marks, or an unclosed shortcode somewhere. If the problem was not resolved in the simplified Form contents, I'll need to take a closer look. I can see the popup on your site, but it looks like I need a login to see the Form within the popup. Please provide login criteria in the private reply fields here and I will review the results.
Hi, it looks like the User profile created for me is a low-level User, I don't have access to Toolset Settings or any other Toolset menu items in the dashboard. Can you upgrade me to an Admin-level user?
My apologies... you're an Admin now 🙂
Okay thanks, unfortunately I don't see anything obviously wrong here. Our setups are quite similar, so I'm not clear why it would be working in my case but not yours. If it's okay with you, I'd like to use the Duplicator plugin (I see it is already installed) to create a site clone. I can install that clone locally and run some additional tests without breaking the live site. Let me know if you approve and I'll get started on that process.
Yes, please go ahead.
Hi Dan,
Christian is currently on vacation at the moment so I will be picking up where he left off.
I've copied your site to my local environment but having a few issues getting it to work correctly.
Once I have any updates on my checks with this I will let you know.
Thanks,
Shane
Hi Dan,
I'm attempting another method to get a copy of your site so that I have the full setup on my end to test.
Thanks,
Shane
Hi Dan,
I'm having issues replicating this on a fresh install since I don't have the premium version of elementor.
Would it be possible for you to setup a clean installation of Elementor and license it and provide me with access to that site ?
If not I should be able to setup a test site where you can install elementor pro and activate the license for me to go through the issue there.
Please let me know.
Thanks,
Shane
Hi Shane,
Yes, I will clone the site to a staging server and give you access to the live site. Can you make my next reply private so I can send you login credentials?
Hi Dan,
I dont need a clone,
I need you to setup a clean website with just toolset and elementor and try to replicate the issue.
I'm unable to do a replication of the issue since I dont have a key for Elementor pro and the popup feature is a premium feature.
I need to ensure this is replicable on a fresh install.
I've enabled the private fields for your next response.
Thanks,
Shane