bmcgin
#1
Suppose I have a button in a form. Is there a way to invoke the “click” event?
I am looking for a javascript function call which will do the same as the user pushing the button.
If possible, I would even like for the button to change its appearance–just as if it was pushed. And then call do whatever it would normally do.
Andrei
#2
hi
add the following code once, make sure form.js is loaded on page
dhtmlXForm.prototype.getButton = function(name) {
return this.doWithItem(name, "getButton");
};
dhtmlXForm.prototype.items.button.getButton = function(item) {
return item;
};
function clickButton(name) {
_dhxForm_doClick(myForm.getButton(name).childNodes[0].childNodes[0],["mousedown","mouseup"])
};
then call clickButton(buttonName)
bmcgin
#3
This worked, thank you.
I turned it into a prototype:
dhtmlXForm.prototype.clickButton=function(name) {
_dhxForm_doClick(this.getButton(name).childNodes[0].childNodes[0],[“mousedown”,“mouseup”])
};
Would be great if this was added into the code base.
Once again, thank you.