facebook

Combobox: CLOSED

💡
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
  • #337900 Reply

    careldegoede
    Member

    Hi guys,

    I am filling a comboxbox via a CSV file.

    I have 2 comboxboxes.
    Comboxbox 1 is my provinces (9 of them).
    comboxbox 2 gets filled pending what is selected in comboxbox 1.

    This all is working GREAT. Except, i need to clear the display text of comboxbox 2.
    In other words, if comboxbox 2 displayed “JOHANNESBURG”, and i re selected a new Province (comboxbox 1);
    my app does re fill comboxbox 2 with the new cities, but it is still displaying the last selected city “JOHANNESBURG”.
    I would like it to be BLANK.

    I have tried millions of options via google, NONE working, please help,
    Allternative option, if comboxbox 2 can display the first item in the newly filled items.

    function processData(allText) {

    var allTextLines = allText.split(/\r\n|\n/);
    var headers = allTextLines[0].split(‘,’);
    var lines = [];

    var value = $(‘select[name=”combobox2″]’);

    value.empty();

    //Trying these variations to remove the displayed text in the combobox
    value.val(”);
    value.html(“”);

    for (var i=0; i<allTextLines.length; i++) {

    var x=1;
    var data = allTextLines[i].split(‘,’);

    if (data[0] == ProvSelected){
    value.append(new Option(data [1],data [1]));
    }

    }

    //Trying these variations to remove the displayed text in the combobox
    value.val(0).change();
    value.clear;

    // die opsie dit die check daar, maar display nie as text nie // value[0].selectedIndex = 0;

    phoneui.alert(‘done’);

    }

    #337901

    nvts
    Member

    You need to add this line to clear in MobiOne.

    $(‘#m1-screenname-combobox’).val (”);

    Change to your app screen name and box name.

    Cheers…

    #337962

    careldegoede
    Member

    Thanks for the reply.
    Much appreciated, however it is not working.
    The “CITY” does not blank out when i select a new “PROVINCE”.

    Any other ideas?

    Very weird that something so simple is being such a pain in the … 🙂

    Can i mail u my app and have a loo at my sample?

    regards

    Carel

    #337980

    Stu Wade
    Member

    Have you tried forcing a screen refresh, something like this. I may have the syntax a little screwed, but I’m new to JavaScript and am posting from memory …

    $(‘select[name=”combo”] option:first’).attr(”selected’,’selected’);
    phoneui.preprocessorDOM(‘#m1-page’);

    Hope this helps.

    #337987

    Brandon
    Member

    This will blank out the combobox2 text, make sure you update it with your screen name on the preprocessDOM

    $(‘select[name=”combobox2″] :selected’).text(”)
    phoneui.preprocessDOM(‘#m1-screenname’); //force UI to update

    #337999

    careldegoede
    Member

    Thanks guys,

    Got it to work with your help.

    Almost got disponded.

    The only thing that got me stuck was the phoneui.preprocessDOM.
    I kept trying the PAGE and MULTIPAGE…
    But the last reply made me replace it with the project name, and whooooopi.
    Now i can continue to my next page…lol.

    Once again, thanks you

    function processData(allText) {

    //phoneui.alert(‘done’);

    var allTextLines = allText.split(/\r\n|\n/);
    var headers = allTextLines[0].split(‘,’);
    var lines = [];

    var value = $(‘select[name=”combobox1″]’);

    value.empty();
    $(‘select[name=”combobox1″] :selected’).text(”)

    for (var i=0; i<allTextLines.length; i++) {

    var x=1;
    var data = allTextLines[i].split(‘,’);

    if (data[0] == ProvSelected){
    value.append(new Option(data [1],data [1]));
    }

    }

    $(‘select[name=”combobox1″] option:first’).attr(‘selected’,’selected’);
    phoneui.preprocessDOM(“#m1-golfcoursefinder”);

    }

    #338083

    jjcous
    Member

    careldegoede,

    is it possible to post your project?
    Trying to fill comboboxes through .csv and give conditions to the comboboxes but can’t get it to work.

    Thanks

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: Combobox: CLOSED

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