Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Vijay on Feb 27, 2009 03:31
open dhtmlx forum
RE: Validating the element which is opened while editing a cell

Hi,

Thanks for your response.

I have tried the same thing in my code also. Its working. Again thanks for your great help.

The important thing which I forgot to furnish in my last post is, Is it possible to get the handle/instance of the text area element to retain the focus on it till user enters alteast  one character in the text area?

Also, I want to restrict the number of characters entered in the text area. So I think it would be great for me, if the instance of the text area is available in while the text area losses its focus/ wwhen TAB key is pressed.

Can we get the textarea instance in the following block.

if ((stage==2)&&(newValue=="")) {//if editor is closed and newValue is empty

alert("value is empty");

}

}

 

 

 

Answer posted by dhxSupport on Feb 27, 2009 04:35

You can use the following code:

function doOnEditCell(stage,rowId,cellInd,newValue,oldValue){

  if ((stage==2)&&(newValue=="")){
  window.setTimeout(function(){
  mygrid.selectCell(mygrid.getRowIndex(rowId),cellInd);
  mygrid.editCell();
  },1);
  }
  return true;
 }