facebook

Need Function to return label name of Clicked/Selected Menu

đź’ˇ
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #327502 Reply

    Dear Tech Support:

    ** A Function to always Return Label Name of the Last Clicked and or Selected Menu Items **

    [b]Using the following code I have been able to grab the label text for a SelecListtMenu type with multiple selection allowed.[/b]

    var summary = “”;
    var summary2 = “”;
    //multiple select list: get selected items as array
    var sumtext1 = $(‘select[name=”selectListMenu1″] :selected’).each(
    function(i, selected) {
    summary += $(selected).text() + “::” + $(selected).val() + “\n”;
    summary2 += $(selected).text() + “? “;
    });
    var summary3 = summary2.split(“?”); var p1 = summary3.length;

    However, assuming the following menu structure, the code above gets me the checked items: Apples, Bananas, Blue. But I am not able to retrieve the labels to top menu items. For example: How do get both lables, “Fruit” and the children items: “Apples, Bananas.”

    Also, you will notice in the example, there are mixed elements making up the “list”. I need to get grab the menu label rather it is “Fruit” (a SelectlistMenu) or “Marbles” (a regular listItem).
    .
    My MENU
    ——————–
    Fruit (SelectListMenu1)

    ————————————————>
    ————————————————-Apples X
    ————————————————-Oranges
    ————————————————-Bananas X
    Planets (SelectListMenu2)

    ————————————————->
    ————————————————–Earth
    ————————————————–Pluto
    ————————————————–Venus
    ——————–
    Marbles (listItem1)

    ———————

    Widgets (listItem2)

    __________________

    Socks (listItem3)

    ———————

    Colors (SelectListMenu3)

    ————————————————->
    – ———————————————–Red
    ————————————————-Blue X
    ———————————————— Green

    Basically, I need the code that would always return the label name for both “Clicked” and/or “Selected” elements. Your help with this matter would be greatly appreciated !

    Best Regards,
    Mike

    #327593

    Hi MJConsulting,

    We don’t understand clearly what you’re requesting. Can you give us more details about your app for a better advice?? Do you only need to know in where section you are?

    #327595

    Hi Octavio,

    Thanks for getting back to me.

    Here is the behavior and my problem. Please see attached:

    (1) If I click Apple, click Grape, Banana, I successfully get the labels names (“Apple”,”Grape”, “Banana”).

    (2) If I now click Orange and then click “Orange-submenu2”, I now get Apple, Grape, Banana, Banana, and “Orange-submenu2” as label names. However, and this is my problem: I am never able to get “Orange” (which has the run screen on click). I do get the Screen2 Menu labels, but not the “parent” Label, if you will, in this case, “Orange.”

    (3) I need to get all label names on Clicked menu items, even when they (a) have sublist items or (b) run a mobi screen or link to external resources.

    Attachments:
    You must be logged in to view attached files.
    #327604

    Brandon
    Member

    I believe you could do something like this (untested code)

    
    function getListItem()
    {
     //get label/text of selected item
    mySelected = $('select[name="selectlist1"] :selected').text();
    if (mySelected == 'Apples')
    {
    //Open the new page
    phoneui.gotoPage("m1-pagename");
    }
    

    and just call the function getListItem() when the list is clicked.

    #327626

    Hi CincyPlanet, and thanks for your suggestions.

    Perhaps I am overlooking something, but when I try this logic, the hml page which contains the new (sub) menu target page is not available. It appears that only lnked pages are available. Using your suggested method, the target pages are no longer linked in MobiOne to any event, therefore, I get page not available when I try calling the target page.

    In other words, to use your example:

    Am I overlooking something?

    Regards,
    Mike

    #327642

    Brandon
    Member

    In mobione if you dont link to the pages they wont be included in the final compile, I already ran into this. An easy fix is to add a link text component, link it to the page you want, then double click and delete the actual text, this way you still have the link and the page will be included, but the unwanted link text doesnt show. That should allow you to use the code concept.

    #327644

    Hi CincyPlanet:

    Thanks for your suggestion. It will work — I had already started that exact work-around !

    Thanks again.

    Regards,
    Mike

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: Need Function to return label name of Clicked/Selected Menu

You must be logged in to post in the forum log in