I'm able to add items at run time. However, when I make a selection, the object that gets passed to my onclick event is what's contained in the <a> tags. I need to be able to at least get the value of an attribute. For example, an href.
I was expecting, like the listbox that I could at least get the index of the selected item. That doesn't appear to be the case. I am getting a string from the object.selection that get's passed.
For example:
Dropdown1.onclick = function(s) {
if (typeof(s) == "object") {
return;
}
NSB.MsgBox(s + " " + Dropdown1.selection + Dropdown1.value);
};
What I need is the index or the selected items id value.
I used the following for reference:
Dr
opdown (Bootstrap) - NSB App Studio
and also reviewed the sample with AppStudio. I'm using 6.0.4
| Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (1) |
Well, I ended up using Select for BootStrap (see Select (Bootstrap) - NSB App Studio
) and that worked out of the box. I would still like to know why DropDown works the way it does. I don't understand why it doesn't return the index or item selection as a value.
Dropdown is working correctly - it is returning the textContent of the selected item.
The only way to do this at present would be to loop through Dropdown_contents to see which item's textContent matches the selected textContent. If you are adding the items at runtime, you probably have a convenient array you can use for this already.
George Henne
NS BASIC Corporation
http://www.nsbasic.com
>I'm able to add items at run time. However, when I make a selection, the
>object that gets passed to my onclick event is what's contained in the
><a> tags. I need to be able to at least get the value of an attribute.
>For example, an href.
>
>
>
>I was expecting, like the listbox that I could at least get the index of
>the selected item. That doesn't appear to be the case. I am getting a
>string from the object.selection that get's passed.
>
>
>
>For example:
>
>Dropdown1.onclick = function(s) {
>
> if (typeof(s) == "object") {
>
> return;
>
> }
>
> NSB.MsgBox(s + " " + Dropdown1.selection + Dropdown1.value);
>
>};
>
>
>
>What I need is the index or the selected items id value.
>
>
>
>I used the following for reference:
>
>Dr opdown (Bootstrap) - NSB App Studio
>
>
>Dropdown (Bootstrap) - NSB App Studio
>Contents 1 Description 2 Properties and Methods 3 Events 4 Example
>(Basic) 5 Example (JavaScript) 6 Output Description Toggleable,
>contextual men...
>View on wiki.nsbasic.com
>Preview by Y ahoo
>
>
>and also reviewed the sample with AppStudio. I'm using 6.0.4
>
>
>
>
>
>
>
>