facebook

Combobox recall problem

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

    nvts
    Member

    Hello,
    I am trying to have a combobox for a selection and store the text/name to a DB. I am using a listview to show the records and then when selected it calls the edit screen to edit the data.

    All this is working except the combobox. I have it where it is storing the text/name to the DB.

    Here is the way I am trying to call it on the list selection:

    $(‘select[name=”editCombo”] :selected’).text(results.rows.item(i).dltype);
    phoneui.preprocessDOM(‘#m1-edit’);

    It is selecting the stored text/name and the phoneui.preprocessDOM causes the other text fields to clear and the edit function not to function properly.

    Thanks

    #338197 Reply

    Yann
    Member

    Hello nvts
    I would try

    $('select[name="editCombo"] option[value="'+results.rows.item(i).dltype+'"]').attr('selected','selected')

    Yann

    #338200 Reply

    nvts
    Member

    Yann,

    Thanks. When I used yours it does not select it. But when I use the one I have it works.

    The problem is the preprocessDOM that has to be called for mine to work. It then messes and clears the other entry fields and then locks the app.

    Cheers…

    #338239 Reply

    nvts
    Member

    Octavio,

    Any ideas on a different way or why this happens?

    Thanks

    #338271 Reply

    @nvts,

    Try Yann’s code plus the phoneui.preprocessDOM function. The next code worked for me with predefined values, but should work too as Yann suggested you.

    $('select[name="combobox1"] option[value="value3"]').attr('selected','selected')
    phoneui.preprocessDOM('#m1-combox');
    
    #338278 Reply

    nvts
    Member

    OK,

    So I changed to add the value to the db instead. Now using the following it makes the selected in the combobox match the db value. Except the showing name text for the combobox value is not the selected value when it is displayed until you click on the combobox it shows.

    $(‘select[name=”editCombo”] option[value=”‘+results.rows.item(i).dltype+'”]’).attr(‘selected’,’selected’);
    phoneui.preprocessDOM(‘#m1-edit-editCombo’);

    How can I get it to display the selected item on the load of the combobox.

    I also removed the phoneui.preprocessDOM(‘#m1-edit-editCombo’); and it works the same without this line. I just cant get it to show the selected on first display. It shows the selected from the combobox setup and then will show the last selected from another edit record, but when clicked on it shows what is stored in the db as the selected.

    Cheers…

    #338348 Reply

    Hi nvts,

    Could you try the preprocessDOM function with just the edit screen:

    $('select[name="editCombo"] option[value="'+results.rows.item(i).dltype+'"]').attr('selected','selected');
    phoneui.preprocessDOM('#m1-edit'); 
Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: Combobox recall problem

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