[nsb-appstudio] BootStrap: Dropdown - How to get the selected item index

61 views
Skip to first unread message

pally@rogers.com [nsbasic-app]

unread,
Dec 3, 2016, 11:33:45 PM12/3/16
to nsbas...@yahoogroups.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...
Preview by Y ahoo


and also reviewed the sample with AppStudio. I'm using 6.0.4




__._,_.___

Posted by: pa...@rogers.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (1)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

pally@rogers.com [nsbasic-app]

unread,
Dec 4, 2016, 2:37:16 AM12/4/16
to nsbas...@yahoogroups.com
 

Well, I ended up using Select for BootStrap (see Select (Bootstrap) - NSB App Studio

Select (Bootstrap) - NSB App Studio
Contents 1 Description 2 Properties and Methods 3 Events 4 Example (Basic) 5 Example (JavaScript) 6 Output Description Provides a popdown list of ...

 

) 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.

__._,_.___

Posted by: pa...@rogers.com

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___

'George Henne' gh@nsbasic.com [nsbasic-app]

unread,
Dec 5, 2016, 9:16:23 AM12/5/16
to Nsbasic App
 

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
>
>
>
>
>
>
>
>

__._,_.___

Posted by: "George Henne" <g...@nsbasic.com>

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.

.

__,_._,___

'Pally@rogers.com' pally@rogers.com [nsbasic-app]

unread,
Dec 5, 2016, 1:49:23 PM12/5/16
to nsbas...@yahoogroups.com
 

Thanks George I reviewed the BootStrap docs and was surprised to find that was the case. The other option worked well and I learned something.

__._,_.___

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.


.

__,_._,___
Reply all
Reply to author
Forward
0 new messages