Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

Conditional Form Validation #453

Open
butchewing opened this issue May 16, 2019 · 0 comments
Open

Conditional Form Validation #453

butchewing opened this issue May 16, 2019 · 0 comments

Comments

@butchewing
Copy link

Is it possible to set a form field to be required if another form field has a value?

Pseudo Code Examples:

if ( "first_name" ) { "last_name" is required }
if ( "yes_no" === "yes" ) { "phone_number" is required }

I can add the required class to the labels on the form with Javascript, but obviously, the validation is not enforced on submit if the rule is not added to the field in the Controller.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant