- This topic has 15 replies, 5 voices, and was last updated 12 years, 1 month ago by
testapps.
-
AuthorPosts
-
bm93MemberMoved to Getting Help forum by support-octavio
Hello, I wonder to make a quiz, and then on the end, show the result…
Any idea?
Thank you guys!
support-octavioMemberHi,
What kind of quiz? what would be the options? I mean:
*More A give a result, more B give other result, …
*Give the result in base the sum of points (a=1, b=2, c=3)
*Others?That’s what I wonder atm, if you share a UI and how do you want to get the result, we could give one or two ideas.
bm93MemberI mean for example, a quiz about soccer, ten questions, each one with four options. On the end, show the number of correct answers and phrase like, “You are great, go ahead”…
Something like this.
Thank you Octavio.
Max87MemberHi,
if you have exact number of questions, which will be repeated, I think it’s simple.
You have to declare variable for correct answers and wrong answers and later check it’s status.
I’ll try to make a sample app for you, it’s interesting idea 🙂edit: you can try my example(attached), it’s very simple, but it’s a start…let me know, if it helped…
Attachments:
You must be logged in to view attached files.
bm93MemberOh Max, thank you.
Well, I know programming on C language, Those like “if” or “else”… “structure repetition” I can do well but i don´t know where to insert on the code (I neither know where to go to access the code on mobione ¬¬), so, if you could help me with these basics I would be glad a lot.
The way you thought is correct, come on ahead…
support-octavioMemberThe javascript code must be added in your <design-file>_custom.js file. Please see the next doc for more information:
Let me know if is helpful for you.
Max87MemberHi,
firstly, you have to create your design in Design center. Then, press green Play button, you will get folder <project-name-www> and then you can insert custom javascript code into <project_name_custom.js>In my example, open screen1.mobi, press play and screen1_www folder will be created. There you will find screen1_custom.js where you can insert your code.
I’m working with inserting questions into local database and getting from it randomly now…
bm93MemberMax, I went something using radiobox, I found a fews on internet but no one using them. Do you have an idea?
Thank you.
Max87MemberBM93: yeah, I use radio buttons too 🙂
Check this document about how to interact with javascript widgets: http://www.genuitec.com/mobile/docs/javaScriptSnippets/javaScriptSnippets.html#radio_button_widget_snippets
profroofsMemberHello,
I am in the 15 day trial period and am deciding on whether to buy the program. I am trying to make an anatomy & physiology quiz but I only know a little C++ from back in the day. I spent all day working with this program and trying to get the quiz to work. When I Unzipped the file that ‘Max87’ created and ran it, it worked perfect!
So I assumed if I copied and pasted the js code and change the ‘#ms-…” file links that it would work. The program I get is that there is NO transition to Question 2. I can run any question on its own and it works fine, but the transition from 1 to 2 does not work. What is weird is that if I set the transition back to the Home page after the question is answered right then it will go. So why does it not want to go to page 2? I put “#ms-question2″ for when it is right (line 47 of the code).
function question1()
{
value = $(‘input[name=”radio-group1”]:checked’).val()
if(value==’right’)
{
alert(“Right answer”);
rightAnswer++;
phoneui.gotoPage(‘#m1-question2’,phoneui.transitions.slideLeft);
}I attached the zip (rar) file.
Thanks,
JohnAttachments:
You must be logged in to view attached files.
support-octavioMemberHi profroofs,
I’ve review your code and fond a few issues, but I think is because you didn’t share all code, please review that your rightAnswer var is declared. Also, make sure that you include your question2.mobi as Additional Project File, because it is not linked with home and question1 screens directly. I’m almost sure that this is the real problem here.
Let me know how it goes for you.
profroofsMemberThanks octavio! Lovely program! I just had to add “Additional Project Files.”
1) So I am assuming I have to do that with every new page for each question and every file in the project?
2) Any simple code you can provide me with that will help me to display at the end what questions the user scored incorrect?
For example, if I had 3 questions with the following topics (1-Adrenal gland; 2-Pancreas; and 3-Pancreas) and the user got questions 2 and 3 wrong then on the results page it would display:
2-Pancreas
3-PancreasSo that in this way they could know what subject they need to study more?
Thanks,
ProfRoofs
http://www.profroofs.com
support-octavioMember>1) So I am assuming I have to do that with every new page for each question and every file in the project?
Yes, you should add the other mobi screen with other questions, to avoid first problem.>2) Any simple code you can provide me with that will help me to display at the end what questions the user scored incorrect?
For the correct/incorrect request, please note that it requires basic-medium skill with javascript programming.For a better advice could you explain with more details what is the result that you want? i.e. you might want to tell user what is the correct answer of every question with wrong answer or maybe just list what were the incorrect questions, a true/false table were list all question and show what was correct/incorrect. If you can mock up a example design would be more helpful, remember that a image say more than a thousand words.
profroofsMemberOctavio,
Thank you for the help.
I changed the code around a bit. I made it so when you call a function like question1() that instead of an alert it takes you to a new screen. However, my problem is that if I go back back again to the question after running the app once, the radio button is STILL CHECKED with my last response. I wanted a way to clear the radio button after the person submits their answer.
Here is the snipet of code for the function:
phoneui.documentReadyHandler = function() {
}
var rightAnswer=0;
var wrongAnswer=0;
var value;
function question1()
{
value = $(‘input[name=”radio-group1″]:checked’).val()
if(value==’right’)
{
phoneui.gotoPage(‘#m1-QuizBasic01Rans’,phoneui.transitions.flipLeft);
}
else
{
phoneui.gotoPage(‘#m1-QuizBasic01Wans’,phoneui.transitions.flipLeft);
}
radio-group1.clearSelection();
}The last commented out part does not work, is there a substitute for this?
radio-group1.clearSelection();
Thanks.
profroofsMemberNever mind, I found it in the example code:
$(“input:radio”).removeAttr(“checked”);
Thanks!
-
AuthorPosts