facebook

I Need Combo Box Example

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

    martechads
    Member

    Hi 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.

    #334692

    @martechads,

    From 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.

    #334693

    Unknown Author
    Participant

    Thank you for purchasing the SETR app. I am glad you are inspired by the acronym lookup.

    -1TC

    #334697

    Max87
    Member

    Hi 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_snippets

    #334730

    martechads
    Member

    Well 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.

    #334731

    martechads
    Member

    So, im guessing the database option

    #334732

    Max87
    Member

    That 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.

    #334738

    Unknown Author
    Participant

    Don’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

    #334742

    martechads
    Member

    I 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.

    #334743

    Unknown Author
    Participant

    Now 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 code

    My 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

Viewing 10 posts - 1 through 10 (of 10 total)
Reply To: I Need Combo Box Example

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