Skip Navigation

[Resolved] Strange conditional group behaviour

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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Author
Posts
#2694070
zero.jpg

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

#2694314

Hi 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.

regards,
Waqar

#2694619

Thank you for 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:


[cred_field field='requested-bands' force_type='field' class='form-control' output='bootstrap' value='1']

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.

nicolaS-3 confirmed that the issue was resolved on 2024-04-29 06:53:21.
This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.