-
I would like to add a custom rule to filter out bad words from an input. It would take an array of strings just like the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I had to dig into the source code a bit to find that the second argument in the callback function should be
I still have questions.
|
Beta Was this translation helpful? Give feedback.
-
I'm a bit confused why you're not just using the Also, it sounds like the below is the portion of the documentation you were looking for. It shows how to pass arguments into a custom validation rule and it shows how to use your custom rule's error properties to provide a custom message. You can also find more information about the error reporting system and what pointers are here: The validation is passed if no errors are reported using the |
Beta Was this translation helpful? Give feedback.
I'm a bit confused why you're not just using the
notIn
rule? It looks like you're pretty much just recreating it under a different name.Also, it sounds like the below is the portion of the documentation you were looking for. It shows how to pass arguments into a custom validation rule and it shows how to use your custom rule's error properties to provide a custom message.
https://docs.adonisjs.com/guides/validator/custom-rules#passing-options-to-the-rule
You can also find more information about the error reporting system and what pointers are here:
https://docs.adonisjs.com/guides/validator/error-reporters#creating-your-error-reporter
The validation is passed if no errors are reported us…