Skip to main content
Known Participant
April 14, 2018
Question

Re: text input Denominator division by pressing a button

  • April 14, 2018
  • 17 replies
  • 1595 views

How do i make a counter like for a survey to add up points if each one counts as one, do i make two boonlean textinputs to be false next to a text input, and a button.

And say if text input1 = textinput2 that text input eqauls 1.

?

And a final total text input that on the same button is the sum of textinput 3 and if i did the same 3 inanother question that it would be textinput 6....(3+6= 2 or 1 depending if there was a match.

This topic has been closed for replies.

17 replies

Known Participant
April 14, 2018

As in my pictures, ive a text field for instructions,the question number, the answer note and the question, and the answer all are text inputs,they are top left grey box, on the right what i write in on the left box appears on the right box except the answer, when i press go on the left, when i press go on the right side the answer only appears in the left box, under the other text inputs , the "inputs called ...recieved are the recieving text input fields, now if teachers answer and students answer are the same it should give a total and im looking for a individual score, q score being the individual score, but im not getting the score and q score functioning yet and also to keep the entered data on the left permanently on the right even if the webpage is refreshed im presuming it will reset, this i have not tried yet and am putting out there imcase theres a code to use that i need to know about, and on the text inputs to make it only alphetical or only numericals

Known Participant
April 15, 2018

the students answer reflect on the teachers question part, from the right were entered to the left where duplicated to, but the score++ doesnt work,

kglad
Community Expert
Community Expert
April 15, 2018

are a student and a teacher answering those questions at the same time?

Known Participant
April 14, 2018

Known Participant
April 14, 2018

? Score ++

.... Could it be qscore++ would it. Do the same

kglad
Community Expert
Community Expert
April 14, 2018

i don't understand what you're trying to show.  but

go1._visible = true;

go1.onRelease = function(){

q1STudentAnswerrecieved.text = q1STudentAnswer.text;  // what's the purpose of this?

q1STudentAnswer.text = q1STudentAnswer.text;  // this looks like it does nothing

if(q1STudentAnswerrecieved == q1teacherAnswer.text){  //  q1STudentAnswerrecieved looks like it's a textfield

score++

}

Known Participant
April 14, 2018

Known Participant
April 14, 2018

Known Participant
April 14, 2018

i went to go make it, and took your code and applied it and am having difficultly, heres my code im using :

go1._visible = true;

go1.onRelease = function(){

q1STudentAnswerrecieved.text = q1STudentAnswer.text;

q1STudentAnswer.text = q1STudentAnswer.text;

if(q1STudentAnswerrecieved == q1teacherAnswer.text){

score++

}

when i drew it out, i used a text input for the correct teachers answer and did an answer input text box for the student and duplicated the students answer to a text box under the teachers correct answer box, and that worked cool as soon as i added the last bit of code it stopped working for me hense im showing you my code i used, which is slightly different in names ,sorry, please help, thank you.

i made two other text inputs called Q score and score; i was hoping that if the two answers match that Qscore will reflect , right, wrong or the actual mark or points for the question, and that "score is the total of them.

Known Participant
April 14, 2018

currently my button code is this :

find2._visible = true;

find2.onRelease = function(){

answer2.text = Number(input2.text)/2;

}

and ive a new text input now, called score. so far its : score._visible = true;

the code you sent to me is it for the button , how does it know if the answer is correct ?

kglad
Community Expert
Community Expert
April 14, 2018

do you ever check if a user's answer is correct?

Known Participant
April 14, 2018

i havent designed it yet , and can quickly put in a "answer thats correct" and boolean it false, so that its in the text input"correct1" and then have an "answer 1" thats filled in, and on a button "go" use "score to total up, and a text input " number1" thats boonleaned false, that on "go" ..

If answer1.text = correct1.text then if so number1.text = 1

kglad
Community Expert
Community Expert
April 14, 2018

create a counter/score variable and initialize it to zero

increment it with each correct answer:

var score:Number=0;

if(<..answer is correct>){

score++;

}