Is there an option for the editor to not allow submitting a form when a specific inpute text field is empty?
Or is preSubmit the only way to go through the fields and return false in case of an empty field?
thanks in advance
Are you talking about a "required" field? Take a look at the https://editor.datatables.net/examples/simple/simple.html and the controller staff.php
Field::inst( 'first_name' )
->validator( Validate::notEmpty( ValidateOptions::inst()
->message( 'A first name is required' )
You can not submit the form with an empty "First name" field.
Ah, but looking over your question again I guess you would want to disable the SUBMIT button and not just a warning? Then the preSubmit could be the way to go but take a look also at disable(). This disables buttons.
Yes, just to echo @asle's comment - generally I would recommend validation be done at the server-side since client-side validation is easy to bypass. But preSubmit is the way to prevent the submission based on a given condition.
It looks like you're new here. If you want to get involved, click one of these buttons!
DataTables designed and created by SpryMedia Ltd.
SpryMedia Ltd is registered in Scotland, company no. SC456502.