Here's the function that checks if the form is complete.
So, what I'm trying to do:
- If radio is not selected, throw a message.
- If radio is "yes", but text is not entered, throw error.
- If radio is "no" but text is entered, make the text empty.
- If all is good, add stuff into `allResponses
The form was displayed 5 times, and input was as follows:
Yes a1
No
Yes a3
No
Yes
Now, this input should display an error since in 5th case, "yes" is selected but nothing is entered in the textbox.
However, I get this:
https://i.sstatic.net/NXMDl.png
Also, the text is not being updated as in 1st and 3rd cases.
I don't know a lot about JS, so please provide me with as explained responses as you can.
EDIT: Complete code: http://pastebin.com/scNSNM2H
Thanks
data["itemIndex"]?datais defined as follows:data = {"itemIndex":-1,"responses":[]}