Home › Toolset Professional Support › [Resolved] Show/Hide based on empty input
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.
Our next available supporter will start replying to tickets in about 6.13 hours from now. Thank you for your understanding.
Tagged: Toolset Forms
This topic contains 27 replies, has 4 voices.
Last updated by yuri.s 8 years, 4 months ago.
Assisted by: yuri.s.
Hi. I've been doing testing. Out of curiosity I greatly reduced the size of my form. See below.
There is now only one cred_show_group below my taxonomy dropdown. However, if I even add a simple conditional above the taxonomy dropdown the conditional below breaks with the "[/cred_show_group]" not closing properly.
[credform class='cred-form cred-keep-original'] [cred_field field='form_messages' value=''] <div class="cred-field cred-field-post_title"> <label class="cred-label"> Vendor Review Name </label> [cred_field field='post_title' post='vendor-reviews' value='' urlparam=''] </div> [cred_show_group if="($(charter-punctuality-review) eq '2' )" mode="slide"] <h3>Write a review for an existing vendor?</h3> [/cred_show_group] <h3> Please choose a vendor type. </h3> [cred_field field='vendor-types' display='select' value='' single_select='true'] [cred_show_group if="($(vendor-types) eq '358' )" mode="slide"] <div class="cred-group cred-group-Charter-/-Boat-Review-Submissions"> <div class="cred-header"><h3>Charter / Boat Review Submissions</h3></div> <div class="cred-field cred-field-charter-email-review"> <label class="cred-label"> Charter Service Email </label> [cred_field field='charter-email-review' post='vendor-reviews' value='' urlparam=''] </div> <div class="cred-field cred-field-charter-website-review"> <label class="cred-label"> Charter Boat\'s Website </label> [cred_field field='charter-website-review' post='vendor-reviews' value='' urlparam=''] </div> <div class="cred-field cred-field-charter-date-review"> <label class="cred-label"> When was your trip? </label> [cred_field field='charter-date-review' post='vendor-reviews' value='' urlparam=''] </div> <div class="cred-field cred-field-charter-rating-review"> <label class="cred-label"> Overall Rating </label> [cred_field field='charter-rating-review' post='vendor-reviews' value='' urlparam=''] </div> <div class="cred-field cred-field-charter-main-review"> <label class="cred-label"> Review </label> [cred_field field='charter-main-review' post='vendor-reviews' value='' urlparam=''] </div> <div class="cred-field cred-field-charter-fish-review"> <label class="cred-label"> What fish did you target? </label> [cred_field field='charter-fish-review' post='vendor-reviews' value='' urlparam=''] </div> <div class="cred-field cred-field-charter-water-review"> <label class="cred-label"> What body of water did you fish? </label> [cred_field field='charter-water-review' post='vendor-reviews' value='' urlparam=''] </div> <div class="cred-field cred-field-charter-passengers-review"> <label class="cred-label"> How many passengers on the boat? </label> [cred_field field='charter-passengers-review' post='vendor-reviews' value='' urlparam=''] </div> <div class="cred-field cred-field-charter-hospitality-review"> <label class="cred-label"> Crew\'s Hospitality </label> [cred_field field='charter-hospitality-review' post='vendor-reviews' value='' urlparam=''] </div> <div class="cred-field cred-field-charter-punctuality-review"> <label class="cred-label"> Crew\'s Punctuality and Organization? </label> [cred_field field='charter-punctuality-review' post='vendor-reviews' value='' urlparam=''] </div> <div class="cred-field cred-field-charter-gear-review"> <label class="cred-label"> Did you use their gear? </label> [cred_field field='charter-gear-review' post='vendor-reviews' value='' urlparam=''] </div> <div class="cred-field cred-field-charter-gearcon-review"> <label class="cred-label"> Condition of gear? </label> [cred_field field='charter-gearcon-review' post='vendor-reviews' value='' urlparam=''] </div> <div class="cred-field cred-field-charter-weather-review"> <label class="cred-label"> Were fishing conditions negatively impacted by the weather/water conditions? </label> [cred_field field='charter-weather-review' post='vendor-reviews' value='' urlparam=''] </div> </div> [cred_field field='form_submit' value='Submit' urlparam=''] [/cred_show_group] [/credform]
I'm doing some testing and found something interesting or odd. When you auto generate your CRED for it adds <div> and <label> tags around your fields.
I have found that when removing these tags, my shortcode evaluates correctly. Strange? See below:
Here the shortcode closing tag does NOT evaluate:
[credform class='cred-form cred-keep-original'] [cred_field field='form_messages' value=''] <div class="cred-field cred-field-post_title"> <label class="cred-label"> Vendor Review Name </label> [cred_field field='post_title' post='vendor-reviews' value='' urlparam=''] </div> [cred_field field='guides-rating-review' post='vendor-reviews' value='' urlparam=''] [cred_show_group if="($(guides-rating-review) eq '2' )" mode="fade-slide"] <h3>Write a review for an existing vendor?</h3> [/cred_show_group] <h3> Please choose a vendor type. </h3> [cred_field field='vendor-types' display='select' value='' single_select='true'] [cred_show_group if="($(vendor-types) eq '357' )" mode="slide"] <div class="cred-field cred-field-tackle-date-review"> <label class="cred-label"> When did you visit? </label> [cred_field field='tackle-date-review' post='vendor-reviews' value='' urlparam=''] </div> [/cred_show_group] [/credform]
HOWEVER, if I remove the auto generated div and label elements from the last conditional it does evaluate correctly.
[credform class='cred-form cred-keep-original'] [cred_field field='form_messages' value=''] <div class="cred-field cred-field-post_title"> <label class="cred-label"> Vendor Review Name </label> [cred_field field='post_title' post='vendor-reviews' value='' urlparam=''] </div> [cred_field field='guides-rating-review' post='vendor-reviews' value='' urlparam=''] [cred_show_group if="($(guides-rating-review) eq '2' )" mode="fade-slide"] <h3>Write a review for an existing vendor?</h3> [/cred_show_group] <h3> Please choose a vendor type. </h3> [cred_field field='vendor-types' display='select' value='' single_select='true'] [cred_show_group if="($(vendor-types) eq '357' )" mode="slide"] [cred_field field='tackle-date-review' post='vendor-reviews' value='' urlparam=''] [/cred_show_group] [/credform]
That's actually good since it's another test possibility for us. I'll pass this info on to our developer.
Thanks!
Regards,
Yuri.
Can you guys think of any workarounds? The development side of this issue may take a while.
I had this great idea (see below) to create a generic_field for a taxonomy dropdown and then use cred_save to try and save the term based on the value. However, the show/hide still doesn't evaluate correctly.
It's soooo weird and frustrating. I'm going nutty over this............
[cred_generic_field field="taxonomyselect" type="select" class="" urlparam=""] { "required":0, "validate_format":0, "persist":0, "default":["choose"], "options":[ {"value":"choose","label":"Choose"}, {"value":"outfitters","label":"Lodges / Outfitters"}, {"value":"guides","label":"Guides"}, {"value":"charters","label":"Charters / Boats"}, {"value":"tackle","label":"Fly / Tackle Shop"} ] } [/cred_generic_field]
I think I figured out the bug. This is an FYI. It only took me 2 days! LOL.
For some reason you cannot close a form with a closing tag for show_group like below:
[/cred_show_group] [/credform]
So what I did as a hack, was to put a hidden input field in between and it evaluated correctly. Like:
[/cred_show_group] [cred_generic_field field="Thistest" type="hidden" class="" urlparam=""] { "required":0, "validate_format":0, "persist":0, "default":"" } [/cred_generic_field] [/credform]
Hi Josh, you are right. I just tested this locally and your temporary solution worked here too. I'm passing all this info to our CRED developer so he can work out a definite solution.
Let me know if there is anything else.
Regards,
Yuri.
Hi Josh, we have just updated our CRED version to 1.4.2.1 and this version has the fix for this issue. You can update it directly in your site's plugin page.
Let me know how it goes.
Regards,
Yuri.
So, I just upgraded and it is worse. All of my code is in this thread. I revert back to 1.4.1 and it works fine.
Now some of my shortcode doesn't output at all. Instead it just lists the raw shortcode like the below.
cred_generic_field field="vendor-name-review" type="textfield" class="" urlparam=""] { "required":1, "validate_format":0, "persist":1, "default":"" } [/cred_generic_field] Choose city, state, country* [cred_generic_field field="google-autocomplete" type="textfield" class="" urlparam=""] { "required":1, "validate_format":0, "persist":0, "default":"" } [/cred_generic_field] [cred_generic_field field="street_number" type="hidden" class="" urlparam=""] { "required":0, "validate_format":0, "persist":1, "default":"" } [/cred_generic_field] [cred_generic_field field="route" type="hidden" class="" urlparam=""] { "required":0, "validate_format":0, "persist":1, "default":"" } [/cred_generic_field] [cred_generic_field field="locality" type="hidden" class="" urlparam=""] { "required":0, "validate_format":0, "persist":1, "default":"" } [/cred_generic_field] [cred_generic_field field="administrative_area_level_1" type="hidden" class="" urlparam=""] { "required":0, "validate_format":0, "persist":1, "default":"" } [/cred_generic_field] [cred_generic_field field="postal_code" type="hidden" class="" urlparam=""] { "required":0, "validate_format":0, "persist":1, "default":"" } [/cred_generic_field] [cred_generic_field field="country" type="hidden" class="" urlparam=""] { "required":0, "validate_format":0, "persist":1, "default":"" } [/cred_generic_field] Vendor Email [cred_field field='vendor-email' post='vendor-reviews' value='' urlparam=''] Vendor Website Address [cred_field field='vendor-website' post='vendor-reviews' value='' urlparam='']
Also, is important to understand when I revert back to 1.4.1 everything works fine. Only when I update does the form output the raw shortcode instead of the form.
Hi I am just following-up here. As I mentioned in the above email. My problem is actually worse now because I can no longer update the plugin without it breaking. I would rather have had it like before as it was just a little hack I needed to do.
Hello,
I'm sorry to hear that you are still experiencing this issue.
Could you use the duplicator plugin an provide us with a duplicator package for us to take a look at ?
You can download the plugin below.
https://wordpress.org/plugins/duplicator/
I will be enabling the private fields for your next reply.
Thanks,
Shane
Hi Josh, currently I'm making another duplicator package from your website to test this issue locally. I'll let you know as soon as I have any updates.
Regards,
Yuri.
Hi Josh, I'm really sorry for having to go back and forth with you on this issue but we have CRED 1.4.2.2 out and I tested it against a duplicator package from your website. As a result, the form is displaying the fields correctly now.
Just to make sure we are on the same page here I'm testing the /?page_id=4 page that shows about 20 fields and is labeled "CRED TEST" in the admin.
Can you confirm that this issue is not present anymore?
Regards,
Yuri.