For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub
- This topic has 6 replies, 2 voices, and was last updated 13 years, 4 months ago by
cmd.
-
AuthorPosts
-
cmdParticipantI 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
CMDApril 16, 2013 at 2:20 pm #338109
Max87MemberHi 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_propertiesyou 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 * lengthVal2. 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 🙂
Max87April 16, 2013 at 3:36 pm #338113
cmdParticipantThanks 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
CMDApril 16, 2013 at 3:56 pm #338114
Max87MemberWhen 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.
April 16, 2013 at 4:38 pm #338115
cmdParticipantThanks max87
How do I insert a screen shot of my layout so you can see what I am talking about?
Thanks
CMDApril 16, 2013 at 4:42 pm #338116
Max87MemberYou can add your screenshots as attachments in Reply editor
April 16, 2013 at 5:05 pm #338120 -
AuthorPosts
