RE: Validating the element which is opened while editing a c


Hi,



Thanks for your post and its working as I expected.



One thing is missed in YOUR last post. Can you please provide me YOUR valuable support for the below question(final).



I would like to restrict the number of characters to be entered in the text area. For example, the user should NOT be allowed to enter more than’ 10’ characters in the text area and it should restrict entering characters without intimation. This scenario should be covered for both events. 1. Entering characters by typing 2. Entering characters by pasting. Please do the needful.



 



 


>>I would like to restrict the number of characters to be entered in the text area. For example, the user should NOT be allowed to enter more than’ 10’ characters in the text area and it should restrict entering characters without intimation.


function doOnEditCell(stage,rowId,cellInd,newValue,oldValue){
if (stage==1){
mygrid.editor.obj.onkeypress = function(e){
if(this.value.length>=5){
return false;
}
}
return true;
}
if (stage==2){
if (newValue==""){
window.setTimeout(function(){
mygrid.selectCell(mygrid.getRowIndex(rowId),cellInd);
mygrid.editCell();
},1);
}
}
return true;
}




>>This scenario should be covered for both events. […] 2. Entering characters by pasting. Please do the needful.


There is no such event which could allow you catch pasting values directly to the open editor from clipboard. Only what you can do is to check newValue after editor was closed and cut unnecessary symbols.