Hi all
I am facing an issue where i want to limit maximum text length a user can enter while creating or editing a row .
I am using Editor.Can this be done?
Please suggest .
And on the client-side you can use the text input control's `maxlength` option which you pass through the text field type's `attr` object: https://editor.datatables.net/fields/#text (example of maxlength in the documentation.
Thanks Allan.
I am able to achieve the client side validation now.But i think ended up doing in different manner:)
In course ,I went through this tutorial -(https://editor.datatables.net/release/DataTables/extras/Editor/examples/clientValidation.html) and implemented this approach for client side validation-
I suspect that you are talking about another approach for client side validation .i have still not got my heads around that.Please intervene if i am not following the correct method for doing the client side validation:-)
Yes, the method shown in that example is perfectly valid as well! Lots of way to do it :-)
Personally, I feel that rather than duplicating code, just let the server do the validation - unless you need it to be realtime of course... (keyup etc).
Replies
Yes absolutely this can be done. On the server-side use a validation method:
[code]
Field::inst( 'myField' )
->validator( 'Validate::maxLen', 100 )
[/code]
And on the client-side you can use the text input control's `maxlength` option which you pass through the text field type's `attr` object: https://editor.datatables.net/fields/#text (example of maxlength in the documentation.
Allan
I am able to achieve the client side validation now.But i think ended up doing in different manner:)
In course ,I went through this tutorial -(https://editor.datatables.net/release/DataTables/extras/Editor/examples/clientValidation.html) and implemented this approach for client side validation-
I suspect that you are talking about another approach for client side validation .i have still not got my heads around that.Please intervene if i am not following the correct method for doing the client side validation:-)
Personally, I feel that rather than duplicating code, just let the server do the validation - unless you need it to be realtime of course... (keyup etc).
Allan