required_if does not run in line with other validations
See original GitHub issueHi all,
I don’t know if this is intended behaviour, but I need to have an email field validated if another field ‘emailRequired’ is eql to ‘yes’. Default is ‘no’.
While all other validations work properly this one does only kick in, when I blur on the email field:
{
name: 'emailRequired',
type: 'hidden'
},
{
name: 'email',
type: 'email',
pattern: '[^ @]*@[^ @]*',
placeholder: 'Email',
rules: 'required_if:emailRequired,yes',
value: ''
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Custom validation RequiredIf in MVC is not triggered
I'm using custom validation attribute RequiredIf to validate some fields in my MVC-Razor application. Everything was working fine, ...
Read more >How to use requiredIf? · Issue #485 · vuelidate ... - GitHub
Probably I've not understood a basic thing: must requiredIf return true to indicate that the field itself is required, or true if the...
Read more >Validate Required Conditional Fields - Kendo UI for jQuery
An example on how to implement required conditional field validation based on the value of another input on the form when working with...
Read more >Validation - Laravel - The PHP Framework For Web Artisans
When validating files, you may simply pass them into the validator with your other data. Working With Error Messages. After calling the messages...
Read more >Validation with the Data Annotation Validators (C#)
Learn how to use the different types of validator... (C#) ... NET MVC team, Microsoft does not offer official product support for the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@the-architect So it isn’t working only on the blur event? Seems like the validator is getting called at the wrong time then, since this library doesn’t take into account any user events.
Hey @the-architect I am going to have to dig deeper into this issue as I have not actually used this functionality personally. I have picked up project maintenance to help @skaterdav85 so I have not touched all the code (yet)