Skip Navigation

[Resolved] Conditional display based on a generic radio field

This support ticket is created 4 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

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)

This topic contains 5 replies, has 3 voices.

Last updated by Pat 4 years, 4 months ago.

Assisted by: Waqar.

Author
Posts
#1412877

Pat

Hello,

I'm using a Cred form and have created a Cred generic radio field (type-adhesion) in order to define a type of subscription.
This field is used to define the associated product that would be charged with WC. Until then, everything works fine.

Now, I need to add a conditional display for additional fields depending of the choice made thanks to the (type-adhesion) field.
I'm not able to make it work like this (it is working fine with a standard radio field but not with a generic radio field).

Is there a way to use the generic radio filed choice as a parameter for the conditional display?

Regards.
Pat

#1413121

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi Pat

I think you will have to switch to expert mode in this case and manually add the condition, like...

[cred_show_group if="( $(my_radio) eq 'value' )" mode="fade-slide"]
  Here if yes
[/cred_show_group]

That should work.

#1413521

Pat

Hi Nigel,

Thanks for the info.

In fact, that was what I was testing thanks to the conditional display button, but this is not working.

Here is the code I'm using in the form (I'm just listing the first conditional display as all other are the same kind) :

[credform]
[cred_field field='form_messages' class='alert alert-warning']
<div class="form-group ">
<label>Type adhésion</label>
[cred_generic_field type='radio' field='type-adhesion']
{
"required":1,
"persist":1,
"default":[],
"options":[{"value":"541","label":"Cannois"},{"value":"542","label":"Non Cannois"},{"value":"543","label":"Non imposable Cannois"},{"value":"544","label":"Non imposable non Cannois"},{"value":"545","label":"Municipaux"},{"value":"546","label":"18-25 ans Cannois"},{"value":"547","label":"18-25 ans non Cannois"},{"value":"548","label":"Mineur"},{"value":"549","label":"Carte UNIA"}]
}
[/cred_generic_field]
</div></br>
[cred_show_group if="( $(type-adhesion) eq '541' )" mode="fade-slide"]
<div class="form-group ">
<label>Facture</label>
[cred_field field='facture' force_type='field' class='form-control' output='bootstrap']
</div>
[/cred_show_group]
<div class="col-sm-12">[cred_field field='form_submit' output='bootstrap' value='Envoi' class='et_pb_button']</div>
[/credform]

Regards
Pat

#1414761

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Pat,

Nigel has a day off today, so I'll be following up on this ticket.

I copied the exact generic field and the conditional group code from your message and tested it in a form on my test website and it worked as expected.

Can you please share temporary admin login details along with the link to the form's page on your website, so that I can troubleshoot this in more detail?

Note: Your next reply will be private and please make a complete backup copy, before sharing the access details.

regards,
Waqar

#1418393

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Pat,

Thank you for sharing the admin access.

The code in your form seems to be correct and it works as expected as it is on my website too, which suggests the issue is something specific to your website.

I'll recommend testing the form with all non-Toolset plugins disabled and with a default theme like Twenty Twenty.

If the issue is fixed, you can start adding the disabled items, one-by-one, to narrow down to a possible conflict.

In case the issue still persists, I'll need a clone/snapshot of your website so that it can be tested on a different server.

Your next reply will be private and here is a guide on sharing the website's clone/snapshot:
https://toolset.com/faq/provide-supporters-copy-site/

regards,
Waqar

#1418455

Pat

Hi Waqar,
Thanks for your time.
I have checked and found that there was already a condition inside the custom fields. So, I remove it to let only the group condition in the form but this changed nothing !
So, I came back to the standard form field (no generic) and the condition works fine.

Regards
Pat

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.