Skip Navigation

[Resolved] Difference between condiitonal output and Cred field condition

This support ticket is created 5 years, 5 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+01:00)

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by Pat 5 years, 5 months ago.

Assisted by: Nigel.

Author
Posts
#1145577

Pat

Hello,

I'm using Cred and need to place some conditions on specific fields (ie : use certain fields only if the condition is OK on other fields).

So, I have 2 ways to do this :
1. Use the field condition inside the custom field editor
2. Use the conditional output inside the Cred forms editor

I would like to understand a little more the difference between those solutions, mainly concerning the ability to define a field "required". That means a field should be required when it is displayed on the form (ie : the condition is OK) and not required if it is not displayed (otherwise, the form would not be able to be validated in the frontend).

Can you give more advice on this?
Regards
Pat

#1145722

Nigel
Supporter

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

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

Hi Pat

The wpv-conditional shortcodes operate when the page is being constructed on the server, so they are evaluated once, before the page is even delivered to the browser. Anything that happens on the browser will have no effect (except where you are updating a page via ajax).

The cred_show_group condition is a JavaScript-based solution that operates in the browser, affecting the visibility of whatever you wrap within it according to the value of some other field, which updates as users interact with the form.

It is similar to making the visibility of an individual field dependent on the value of another field, which you can set when creating your custom fields at Toolset > Custom Fields (https://toolset.com/documentation/user-guides/types-custom-fields-conditional-display/).

Now, assuming everything is working correctly, if you set a field as required, but then only display the field depending on the value of another field, the required setting should only be enforced if the field is actually visible.

Try that and if you find different let me know.

#1146354

Pat

Hi Nigel,

You're right. The cred_show_group condition (Javascript) works right and the condition is linked with the "required" parameter only if the field is visible.

Many thanks
Pat

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