Hi all,
I have a field in the Events CPT that gets a value from 0 to 6 when the post is created (select field, see picture). In the edit form I need to test the field value and show some fields only if value = 0. So I have added a conditional group in the form like this:
[cred_show_group if="( $(requested-bands) eq '0' )" mode="none"] ......... additional fields here .....[/cred_show_group] (In the picture, in place of the additional fields I have entered the statement "This string should show if field value = 0 !" ) between dotted lines. The string should appear where the blue dot is).
The test fails and the additional fields/string aren't shown when the field value is 0. I've also tried changing the select value from 0 to 9, but no changes. If for testing purposes I change the test to "$(requested-bands) gt 0" or "$(requested-bands) ne 0" the string always appears, also if field value = 0 ! It behaves like the field value isn't actually 0, but I have checked that there are no extra characters (see meta_value and asterisks in picture).
Any clue ? or is it a bug ?
thanks
Regards
Nicola
Thank you for contacting us and I'd be happy to assist.
Based on your details, I've performed some tests on my website, but couldn't reproduce this behavior. The conditional field group worked as expected, for the '0' value coming from a select field.
Looks like something specific to your website is involved. Can you please share temporary admin login details, along with the link to the page where this form can be seen?
Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.
During troubleshooting, I noticed that in the form 'Edit event pub_manager', the following shortcode was being used for the 'Nbr of requested bands' field:
Because of the attribute value='1', the form would set the value for this field after loading to '1' no matter the actual value saved in the database.
And because the conditional field groups operate on the front-end form values, the conditional field group condition was failing. I've removed the value='1' attribute and the conditional field group is working as expected now.