facebook

Spinner Selection

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

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

    cmd
    Participant

    I am a beginner to javascript so please bare with me. I am trying to build an app where the user makes a selection from a spinner wheel (id: tree) and then has to make another selection from a spinner wheel (id: diameter) and they have to make a final selection from another spinner wheel (id:length). I need diameter and length to multiply and give me the answer. Example: diameter = 50 and length = 3 and the result would be 150. That is the first issue. The second issue is that each selection in the initial spinner wheel (id:tree) will have a different set of values for the spinner wheel diamter. Please help if possible.

    Thanks
    CMD

    #338109

    Max87
    Member

    Hi cmd,
    I try to help you:
    1. if you want to know what value is selected from spinner wheel(combobox), according to this document: http://www.genuitec.com/mobile/docs/widgetReference/widgetReference.html#list_properties

    you get your value by writing this:

    var treeVal = $('select[name="tree"]').val()
    

    you will write this code three times to get value from all comboboxes and then you will get your result:

    var result = diameterVal *  lengthVal

    2. to answer your second question, I would use local database or array and dynamically add values into comboboxes. I recommend Texotela jquery selectbox manipulation plugin (http://www.texotela.co.uk/code/jquery/select/) which is easy to use.

    I hope my answer help you a little 🙂
    Max87

    #338113

    cmd
    Participant

    Thanks Max87.

    Is the code var treeVal = $(‘select[name=”tree”]’).val() applied to the spinner wheel itself?

    Also, where is the code var result = diameterVal * lengthVal applied to? Is it the diameter spinner wheel and the length spinner wheel? What code would be applied to the answer text box to get the result?

    Thanks you so much for your help
    CMD

    #338114

    Max87
    Member

    When you run your app in Test center, <project-name>_custom.js is created and this is the file you should put your custom code in.
    <Is the code var treeVal = $(‘select[name=”tree”]’).val() applied to the spinner wheel itself?>
    I don’t really understand this question. For example, you have app with 3 combo boxes, one edit box or text widget and a button which triggers the script. So enter your values into comboboxes in Design center, set onClick function for button to call your function and remember id of text widget. So the result can be displayed into text widget like this:

    $("#text_widget_id").text(result);

    Also check that MobiOne help page I posted, you can find informations how to work with widgets, set/get its values, etc.

    #338115

    cmd
    Participant

    Thanks max87

    How do I insert a screen shot of my layout so you can see what I am talking about?

    Thanks
    CMD

    #338116

    Max87
    Member

    You can add your screenshots as attachments in Reply editor

    #338120

    cmd
    Participant

    Max87

    I have attached a jpg for reference.

    Thanks and let me know your thoughts please.
    CMD

    Attachments:
    You must be logged in to view attached files.
Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: Spinner Selection

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