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).
Les langues: Anglais (English )Espagnol (Español )
Fuseau horaire: Europe/London (GMT+00: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.
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.