Sorry, that's how it works. JScript doesn't understand the "::" part on it's own. Since you don't like that answer, why not use the standard, perhaps more elegant, solution?
function myButtonProcess()
{
XDocument.UI.Alert("Whoohoo!");
}
function btnA::OnClick(eventObj)
{
myButtonProcess();
}
function btnB::OnClick(eventObj)
{
myButtonProcess();
}
--
Greg Collins [InfoPath MVP]
Please visit:
http://www.InfoPathDev.com
You *have* to be joking
Cool? Ugly, more like. Can I do the assignment
somehow not at the definition? Something more like:
var myBtnA = btnA::OnClick;
I feel I could live with that better... But perhaps not, since I couldn't
get to call the function that way in the first place...
Greg Collins said:
Sure you can... just create a variable reference to the OnClick handler like so:
myBtnA = function btnA::OnClick(eventObj)
{
XDocument.UI.Alert("Whoohoo!");
}
function btnB::OnClick(eventObj)
{
myBtnA();
}
Notice the assignment of the function to the myBtnA variable?
Now you just call the function via the variable reference.
Cool, eh?
--
Greg Collins [InfoPath MVP]
Please visit:
http://www.InfoPathDev.com
Can I write code (MS Script) from one button click handler to click another
button, or at least call its OnClick handler? I'm too lazy to factor out the
code into a shared function....