On my regular forms, I use event.getOwner().elementName to initialize my scripts. But apparently, it doesn't work with components. I just have 2 scripts, one for each button in the Component. So, I want to use:
if (event.getOwner().elementName == "button1ControlName"){
do sth
}
if (event.getOwner().elementName == "button2ControlName"){
do sth
}
This way, I can reduce the script to one file. Any ideas?
Using element name in Components
Moderators: Jon, Steve, Ian, Dave
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
event.getOwner().elementName is returning the full name of the button with the component prefix added to the front of the name. You could use:
(This uses the Java String class instead of the Javascript String because the Javascript version doesn't have an endsWith method.)
Code: Select all
if (new java.lang.String(event.owner.elementName).endsWith("button1ControlName"))
..
0 x
Who is online
Users browsing this forum: No registered users and 20 guests