Problem: I have two custom fields in a Form, and I would like to only allow one of the fields to be filled in. I would like to set up some form validation that prevents form submission if a User fills in values for both fields.
Solution: There are two options in our system:
- Conditional Form Groups: You can use Conditional Form Groups to show or hide the "Submit" button based on the value of these fields. If both fields are not empty, then you can hide the submit button. This is "front-end" validation, meaning that the validation occurs before the form is submitted.
- Custom validation API: You can use custom code to validate form fields on the "back-end". If errors are detected, the form will reload and display your custom error messages. This requires PHP code.
Beyond that you may be able to use custom JavaScript to handle this type of DOM manipulation.
Relevant Documentation:
https://toolset.com/documentation/user-guides/conditional-display-for-form-inputs/
https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_validate
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.
Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
Dieses Thema enthält 4 Antworten, hat 2 Stimmen.
Zuletzt aktualisiert von vor 6 Jahren, 6 Monaten.
Assistiert von: Christian Cox.