- This topic has 6 replies, 3 voices, and was last updated 11 years, 7 months ago by support-octavio.
-
AuthorPosts
-
nvtsMemberHello,
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
YannMemberHello nvts
I would try$('select[name="editCombo"] option[value="'+results.rows.item(i).dltype+'"]').attr('selected','selected')
Yann
nvtsMemberYann,
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…
nvtsMemberOctavio,
Any ideas on a different way or why this happens?
Thanks
support-octavioMemberTry 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');
nvtsMemberOK,
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…
support-octavioMemberHi 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');
-
AuthorPosts