[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.
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).
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.
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.
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.