Anybody have any luck with getting a DropDownList to work with onChange?
What I am trying to do is avoid a "Do it" button. I want to simply have the function trigger when the drop down list is changed..
Like this:
pal.grp.OQ.List.selection.onChange = function () {
alert("yo");
}
but it doesn't seem to work.. buttons and checkboxes with onClick seem to work fine..
-Lloyd
ScriptUI DropDownList and onChange
Moderator: Paul Tuersley
- lloydalvarez
- Enhancement master
- Posts: 460
- Joined: June 17th, 2004, 9:27 am
- Location: New York City, NY
- Contact:
- redefinery
- Posts: 112
- Joined: April 1st, 2005, 8:16 pm
- Location: CA
- Contact:
i already replied to lloyd directly, but if anyone else is curious, the onChange callback is for the dropdownlist object (List), so it needs to be:lloydalvarez wrote:Anybody have any luck with getting a DropDownList to work with onChange?
pal.grp.OQ.List.selection.onChange = function () {
alert("yo");
}
but it doesn't seem to work.. buttons and checkboxes with onClick seem to work fine..
-Lloyd
Code: Select all
pal.grp.OQ.List.onChange = function () {
alert("yo, you selected item " + this.selection.index);
}
:jeff
Here is a snippet of my code on how I got it to work for one of my DropDownList scripts:
I only show here one of the 17 (!) options in the drop down list array in this script. Of course the DropDownList Array calls back up to a very extensive list of UI Groups in the "var res =" instanceof Panel section above all of this which in itself took a good while to script. Maybe this can give you or someone else another idea. 
Code: Select all
pal.grp = pal.add(res);
pal.layout.layout(true);
pal.grp.minimumSize = pal.grp.size;
pal.layout.resize();
pal.onResizing = pal.onResize = function () {this.layout.resize();}
pal.grp.header.help.onClick = function () {alert(aeMarketsData.scriptTitle + "\n" + aeMarketsData.strAbout);}
pal.grp.DropDownList.onChange = function () {
if (this.selection != null) {
for (var g = 0; g < this.items.length; g++)
this.items[g].group.visible = false; //hide all other groups
this.selection.group.visible = true;//show this group
}
}
var item = pal.grp.DropDownList.add('item', 'Akron Real Estate');
item.group = pal.grp.allGroups.akRe;
pal.grp.allGroups.akRe.Panel1.name.b1.onClick = function () {renderSelectedComp320x240FLV(this.parent.parent, false);}
pal.grp.allGroups.akRe.Panel2.name.b2.onClick = function () {renderSelectedComp7secFLV(this.parent.parent, false);}
