Form event onBeforeChange

Hi,
i’ve a trouble with the event onBeforeChange.
This event is called only when the input box lose the focus for another form object.
If i click on a toolbar or other object the event is not fired.

Thanks in advance.

Is there anybody out there?

We have not recreate the problem locally. Could you provide the sample that demonstrates the problem ?

sintesigroup.it:8080/idea/

Path to recreate the problem:

  1. Open the link! :smiley:
  2. Click on the carton box on toolbar
  3. DlbClick on a random element of the grid
  4. Press Save
  5. Try to write something on the form. In this case the onbeforechange need to be fired but it happen only when the control lose the focus.

Thanks in advance

Is there anybody out there?

Hello,

Try to write something on the form. In this case the onbeforechange need to be fired but it happen only when the control lose the focus.

This is a designed behaviour. onBeforeChange and onChange are called on blur. In your previous message you wrote “If i click on a toolbar or other object the event is not fired.” and this problem was not reproduced…

If you want to call some functionality, on mousedown you need to get event handler manually. To the handler you need to define the method that returns input object:

For form 2.6 getInput can be defined as follows:

dhtmlXForm.prototype.items.input.getInput=function(item){
return item.childNodes[0].childNodes[1].childNodes[0];
};

To call this method use:

var inputObj = yourForm.doWithItem(inputNameHere, “getInput”);
inputObj.onkeydown = function(){
/your code here/
}