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...

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")}

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();
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.