Validation with join tables not working
Validation with join tables not working
Hi,
I have a joined field with the same structure of the example: https://editor.datatables.net/examples/simple/join.html
I suppose the row
->validator( Validate::dbValues() ),
should fail the validation if no options are selected, but it's not working in my code and in the example too.
My joined table contains no empty rows, what's the correct way to setup the validator to require a user selection?
Thank you,
This discussion has been closed.
Replies
it's all in the docs; just take a look pls
https://editor.datatables.net/manual/php/validation
You gave me the idea to mix together validators and I made it working with 'dbValues' and 'required'.
It never worked with 'notEmpty' or a single validator.
The validation documentation wasn't explicit enough for me, in the dbValues paragraph the phrase: "Allow only a value that is present in a database column." made me think that empty values were not allowed. It's actually "Allow an empty value or a value that is present in a database column".
Thank you very much
you can always build your own validators without any limitations like this for example:
You can use multiple fields from what is returned to the server as well:
I think it is also worth looking at global validators in the docs.