- This topic has 9 replies, 4 voices, and was last updated 12 years, 5 months ago by
Unknown Author.
-
AuthorPosts
-
martechadsMemberHi Team,
I have reviewed a number of topics on combo boxes. I need help with code for this widget. I would like to list words on the combo box, and once selected it simply reviews the definition of the word. But I’ve looked everywhere and cant fine a sample to load. Looking for a similar example like SETR put in his app built on mobione in the app store.
January 28, 2013 at 11:21 pm #334692
support-octavioMemberFrom your description I understood something like to change the text on a textfield based on the combobox selection, I will probably be able to provide a simple snippet code tomorrow, but note that will require basic javascript skills to modify it to commit your requirements.
January 28, 2013 at 11:28 pm #334693
Unknown AuthorParticipantThank you for purchasing the SETR app. I am glad you are inspired by the acronym lookup.
-1TC
January 29, 2013 at 1:13 am #334697
Max87MemberHi martechads,
would you like to use selection from combo boxes to create query for database?
Or simple example how to select combobox value is enough?
Pls describe more what will your app do and check this link(how to customize widgets with js):
http://www.genuitec.com/mobile/docs/javaScriptSnippets/javaScriptSnippets.html#combobox_widget_snippetsJanuary 29, 2013 at 4:55 pm #334730
martechadsMemberWell I wish I knew more about code to offer you the exact answer. Basically, I would like to use the Combo box option from MobiOne, Have about 6-10 words listed as the items to choose from. Once a word is selected, the description or definition is displayed on the page of the selected item. So im not sure what that requires. Probably something really simple for someone that knows code.
January 29, 2013 at 4:57 pm #334731
martechadsMemberSo, im guessing the database option
January 29, 2013 at 5:08 pm #334732
Max87MemberThat is so easy…create table with two collumns – id and definition
id is integer, auto increment
definition is your definition string for word.
In design center create combobox with your words as description and numbers 1-10 as value. I expect, that your combobox is called combobox1. Set it onChange action to run javascript – define();
Code for return selected combobox value is:var word = $('select[name="combobox1"]').val();
So now you can create and execute sql query and display the result.
I can provide you full example tommorow, if you need it.January 29, 2013 at 6:55 pm #334738
Unknown AuthorParticipantDon’t futz around with a database if you don’t have to.
function doit(){ var n = $('select[name="combobox1"]').val(); $('#m1-Page1-text1').text(n); }
To get the text to wrap, put some spaces in there to start.
-1TC
January 29, 2013 at 8:09 pm #334742
martechadsMemberI appreciate your help guys. I would like to skip the database….only if its possible. I started a new mobione page for my app, selected the combo box from the select and input selection. Then selected the “actions” as run javascript. I copied and paste the code in the run javascript code:
function doit(){
var n = $(‘select[name=”combobox1″]’).val();
$(‘#m1-Page1-text1’).text(n);
}I double clicked the combo box, and changed the label and value to something different like : test 1
test 2, test 3, and some text in the value area. but nothing happens?? Clrealy I’m missing something on the code.January 29, 2013 at 9:22 pm #334743
Unknown AuthorParticipantNow that you have your code, you need to set up everything around it.
1. In Design Center, select the combobox.
2. On change –>Run Javascript–>doit();
3. Put the function itself in the <name>_custom.js file
4. Make sure your combobox is actually named combobox1, if not, change the code
5. Make sure your page is called Page1 – if not, change the code
6. Make sure that your textarea is called text1 – if not, change the codeMy guess is that your page is not named Page1, but, rather, something else.
Finally, remember: You’re going to see the results in Test Center, not Design Center.
-1TC
-
AuthorPosts