facebook

set selected item in combobox? CLOSED

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

    txarly
    Member

    how can i display the combobox values depending how they were stored in a database?
    i want the value showed changes according how they are stored.I can store them and retrieve the value from the database, just want the combobox change the value.I have tried different codes but not success 🙁

     $('select[name="combobox1"] ').val(value) 

    value is what i get from the database.

    thanks

    #331577

    Hi txarly,

    I’ve tried with next code and worked fine.

    @valueX wrote:

    ‘).attr(‘selected’,’selected’)
    phoneui.preprocessDOM(‘#m1-combo’);

    #331607

    txarly
    Member

    mmm it doesn´t work for me Octavio.

    I attach a simple exemple

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

    Hi,

    Seems the problem is that you’re initializing the options for combobox without value:

      $('select[name="combobox1"]').append( new Option("peter pan 2") );

    Try this and let me know how it goes:

    $('select[name="combobox1"]').append( new Option("option 1","1") );
    $('select[name="combobox1"] option[value="1"]').attr('selected','selected') 
    #331625

    txarly
    Member

    Yes, you were right.Everithing works well now.Thank you very much

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: set selected item in combobox? CLOSED

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