question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

required_if does not run in line with other validations

See original GitHub issue

Hi 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:open
  • Created 6 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
iamdtangcommented, Jul 10, 2017

@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.

1reaction
mikeericksoncommented, Jul 10, 2017

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)

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found