0

Hi everyone,
Firstly,sorry about my bad english.i hope telling my problem clearly:) anyway i want to tell about my project.it s about survey system..I am creatin g dynamic questions and question's choices(radiobuttons or checkboxes) from database when runtime..after users answer the question,press next button to pass the next questions

For examle
1) Question definition
a)choice definition
b)choice definition
c)....

Users have to choosee any choices..if not,my system is giving alert,Actually my problem is about checkboxes..I created hidden textboxes,if question choices' type is checkbox..so the last choice definition is name "Other"..if user checks the other choice,the hidden textbox is going to be visible..it is all okay until here..I want to give a error alert if user checks the other choice and doesnt fill the textbox when press next question..I dont validate this..How can i do it..Anyone can help me?

Thanks for all...

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by futingkiller
0

You could do a check on the value something like

if (tBox.value != ""){//proceed to next question}else{alert("Please enter a value in the textbox")}
0

Hi everyone,
Firstly,sorry about my bad english.i hope telling my problem clearly:) anyway i want to tell about my project.it s about survey system..I am creatin g dynamic questions and question's choices(radiobuttons or checkboxes) from database when runtime..after users answer the question,press next button to pass the next questions

For examle
1) Question definition
a)choice definition
b)choice definition
c)....

Users have to choosee any choices..if not,my system is giving alert,Actually my problem is about checkboxes..I created hidden textboxes,if question choices' type is checkbox..so the last choice definition is name "Other"..if user checks the other choice,the hidden textbox is going to be visible..it is all okay until here..I want to give a error alert if user checks the other choice and doesnt fill the textbox when press next question..I dont validate this..How can i do it..Anyone can help me?

Thanks for all...

try something like this:

function check_form()
{
if (document.getElementById('the_other_checkbox_id').checked==true)
     if(document.getElementById('the_textbox_id').value=="")
          alert('something');
    else
          go_to_next_question();
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.