- This topic has 45 replies, 3 voices, and was last updated 12 years, 4 months ago by
support-octavio.
-
AuthorPosts
-
adikateMemberHi, i need help regarding my app development. I got two screens which consists of only two buttons(YES, NO). If i press YES in both screen i should get message as “WHITE” and if i press NO in both screen i should get message as “BLUE”.
KaleMemberHi,
just insert a label in each screen and set the text for both labels when a button is pressed.
function buttonYes() {
$(‘#m1-screen1-label1’).text(‘WHITE’);
$(‘#m1-screen2-label1’).text(‘WHITE’);
}function buttonNo() {
$(‘#m1-screen1-label1’).text(‘BLUE’);
$(‘#m1-screen2-label1’).text(‘BLUE’);
}Set the onclick Action for each of the buttons to Run JavaScript and call one of the functions with
buttonYes()
or
buttonNo()
Kale
adikateMemberhi kale, thanks 4 reply. I want 2 make slight change 2 my app. suppose if both screen consists of two items. Let’s say Screen 1 has WHITE, BLUE and Screen 2 has GREEN, YELLOW.
If I press both YES in Screen1 and Screen2 then i should get message in Screen3 as WHITE
If I press YES in Screen1 and NO in Screen2 then i should get message in Screen3 as BLUE
If I press NO in Screen 1 and YES in Screen2 then i should get message in Screen 3 as GREEN
If I press both NO in Screen 1 and Screen2 then i should get message in Screen 3 as YELLOW
KaleMemberHi,
I attached a zip file with a hopefully working solution.
Kale
Attachments:
You must be logged in to view attached files.
adikateMemberhi kale, i attached my screenshots. i know how to do on screen actions after clicking, what i need is the java script to run my app as per the last post.
If I press both YES in Screen1 and Screen2 then i should get message in Screen3 as WHITE
If I press YES in Screen1 and NO in Screen2 then i should get message in Screen3 as BLUE
If I press NO in Screen 1 and YES in Screen2 then i should get message in Screen 3 as GREEN
If I press both NO in Screen 1 and Screen2 then i should get message in Screen 3 as YELLOWAttachments:
You must be logged in to view attached files.
support-octavioMemberHi adikate,
Your request is very similar at the one in this next thread, please take a look: http://www.genuitec.com/support-genuitec/viewtopic.php?f=8&t=3259
adikateMemberThe javascript provided in thread is quite hard 2 understand. Can u please make it clearer bcoz I am new to jscript.
adikateMemberi tried with the code what u have given. my app has items like white,blue,etc. these items are just present in the screen and cannot be selected. only the yes and no buttons can be selected. so the code is not giving the result the way i want. Help me with this please
adikateMembergo to next screen is working fine with my app but the problem is with the jscript code that not executing according to the response.
adikateMemberno one is there to help me with my problem.
adikateMemberi am attaching the jscript code that i used in my app. i used the same screen names and item names as given in the thread. i am spending my maximum time with the app but i cant able to achieve what i need. please help me with this.
Attachments:
You must be logged in to view attached files.
support-octavioMemberHi adikate,
Could you please check in the DOM inspector that there is not javascript syntax errors? I think you’re missing the hack link. If that isn’t the issue, tomorrow I will draft a design to help you.
adikateMemberthanks 4 reply. as i said earlier my app has three screens. i attached my jscript code in my last post. i inserted my jscript code in screen1_custom.js in the app. now you said to check my DOM inspector. i am attaching my DOM screenshot.
Attachments:
You must be logged in to view attached files.
support-octavioMemberHi adikate,
I’m sharing the code that I use in the other thread making some tweaks to work as you ask. Also, I put more comments to let you understand it.
var previousANS; //var that save the first answer to compare at the last screen. function gotoScreen(screen, answer){//this function receive the current screen, and the label of answer so, you should call it on your four buttons: Yes button: gotoScreen(1,"YES"); No button: gotoScreen(1,"NO"); And the same for second screen but change the 1 for a 2. */ if(screen==1){ phoneui.gotoPage("m1-screen2",'NONE'); //go to second page and change the list items text if(answer=="NO"){// if answer is NO, change the values of your list items $('#m1-screen2-').html("GREEN"); //note: "m1-screen2-" is the id for the select list item. You can get it with DOM Inspector $('#m1-screen2-2').html("YELLOW"); }//if else if(answer=="YES"){ $('#m1-screen2-').html("WHITE"); $('#m1-screen2-2').html("BLUE"); }//else if previousANS = answer; }///if screen == 1 else if(screen==2){ phoneui.gotoPage("m1-screen3",'NONE'); //go to last page and set the text according the combination of responses /* when this function is called as "gotoScreen(2, answer)", I know that I have to get the results with the previos answer (that is set the first time that this function is called) and the new answer just have to set the result according the combinations of both answers */ var text =""; if(previousANS=="NO"&&answer=="NO") text = "YELLOW"; else if(previousANS=="NO"&&answer=="YES") text = "GREEN"; else if(previousANS=="YES"&&answer=="NO") text = "BLUE"; else if(previousANS=="YES"&&answer=="YES") text = "WHITE"; $('#m1-screen3-text1').text(text); //set the value for the result in the screen3 }//if screen == 2 }//gotoScreen
Hope this helps. If you don’t get it works I can take a look at your designs.
-
AuthorPosts