In html , To limit the number of characters a user can type into input fields, we use the attribute maxlength.
Ex:
So, the user cannot enter more than 5 charcters in the input text area.
What is the dhtmlx equivalent of the html attribute maxlength, so that the user cannot enter more than 5 characters in the input editable cell inside the dhtmlxgrid.
Please Help
Please suggest if there is some flaw in the following code and whether it works for setting the maxlength attribute in an alternative way. Not sure this is valid, but if possible to set the attribute maxlength in this way, it would be good.
Code:
var cell = mygrid.editor.cell;
var editor = cell.getElementsByTagName(‘input’)[0]||cell.getElementsByTagName(‘textarea’)[0]; editor.setAttribute(“maxlength”,5); //or any other necessary value
Please tell me is there any other possibility to prevent users from entering more characters in a dhtmlx cell other than key Press detection and Validation.