facebook

Dynamically Fill Combo After Another Combo Changes

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

    Pablo22
    Member

    New to MobiOne (v2.3.1) but love it so far but I have this problem. One one of my screens I have two combos, cCountry and cPlace and I want to dynamically fill cPlace after the cCountry changes. I can populate cPlace correctly and select the first item in the list (always ‘Unknown’) but the text portion of cPlace remains still blank until I physically change its value.

    Any help greatly appreciated.

    #335113 Reply

    @Pablo22,

    A similar question here:
    http://www.genuitec.com/support-genuitec/viewtopic.php?f=9&t=4323

    You should change some things as call a function in the Action: onChange of your first combobox. Let me know if you need further assistance.

    #335126 Reply

    Pablo22
    Member

    @Octavio
    Thanks for the quick response.
    The link you gave me takes me to a topic regarding adding gaming capabilities so I think that’s the wrong one.

    Anyway, I don’t think I could have explained my problem clearly.
    I am calling the javescript function using the OnChange event of the first combo and the second combo is populating correctly.
    The drop down portion of the combo lists the items and the first one is selected as expected but the text value of the first item isn’t showing in the combo. Like this…

    If I select the other item in the list it’s works fine from then on.

    The code is very simple at the moment while I find my way around but is as follows…
    var i = 10;
    function doCountryChange() {
    //Clear Place drop down
    $(‘#m1-pCheckIn-hidden-select-cPlace’).empty();

    //Add new item
    $(‘#m1-pCheckIn-hidden-select-cPlace’).append(‘<option value=”Unknown” label=”Unknown”>Unknown</option>’);
    $(‘#m1-pCheckIn-hidden-select-cPlace’).append(‘<option value=”NewPlace’ + i + ‘” label=”New Place ‘ + i + ‘”>New Place ‘ + i + ‘</option>’);
    $(‘select[name=”cPlace”] option:first’).attr(‘selected’,’selected’);
    phoneui.preprocessDOM(‘pCheckIn’);

    //Increment counter
    i++;
    return;
    }

    cPlace is the name of the second combo and pCheckIn the name of the screen.

    Sorry if I wasn’t clear before. Hope this is more so.
    Paul

    #335134 Reply

    Pablo22
    Member

    Just figured it out. I have to set the text property of the second combo as well, as in
    $(‘#m1-pCheckIn-cPlace’).text(‘Unknown’);

    Thanks.
    Great product by the way.
    Paul

    #335138 Reply

    Hi Pablo22,

    Apologies for provide you a wrong url. I messed up with a url that was viewtopic.php?t=4323?view=next, so I incorrectly delete the “?view=next” part and that was that lead you to wrong topic. I updated the link and it should be the right one now 🙂

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Dynamically Fill Combo After Another Combo Changes

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