Set at least one field as required
Set at least one field as required
Tocafundo
Posts: 3Questions: 1Answers: 0
I have two fields and I want that at least one of then be required. Just one can be empty, not both. Can I do that?
This discussion has been closed.
Answers
Yes, you can. If you want to know how please let us know what you are using and share your code. Many thanks.
Assuming you are using the PHP libraries for Editor, a global validator can be used for what you are looking for. The NodeJS and .NET libraries have similar options.
Allan
Yes, I am using PHP. This is my code and the two fields I want to do.
Allan recommended using a global validator.
https://editor.datatables.net/manual/php/validation#Global-validators
You would provide it with a function to determine whether both fields are empty.
Here is another example of a global validator. You can do all sorts of things with it ...
Saudações ao Brasil
Thank you all from Brazil! I will get it.