Skip to content

Overriding rule arguments for Required rule and AllowFalse:true #3482

Answered by logaretm
Nataliasem asked this question in Q&A
Discussion options

You must be logged in to vote

The documentation only applies to rules if used as is, since you provided your own params you will overwrite the old one which removes allowFalse from the rule.

You should try to merge your params with the rules own params:

 extend('required', {
    ...rules.required,
    params: [...rules.required.params, 'customMessage', 'noErrorText', 'messageType']
})

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Nataliasem
Comment options

Answer selected by Nataliasem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants