Textbox validate

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Jun 2009
Posts: 1
Reputation: ofoman is an unknown quantity at this point 
Solved Threads: 0
ofoman ofoman is offline Offline
Newbie Poster

Textbox validate

 
0
  #1
Nov 2nd, 2009
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...
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 318
Reputation: Thirusha is an unknown quantity at this point 
Solved Threads: 51
Thirusha's Avatar
Thirusha Thirusha is offline Offline
Posting Whiz
 
0
  #2
Nov 3rd, 2009
You could do a check on the value something like
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. if (tBox.value != ""){//proceed to next question}else{alert("Please enter a value in the textbox")}
Life... Is a Moment
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 17
Reputation: futingkiller is an unknown quantity at this point 
Solved Threads: 2
futingkiller futingkiller is offline Offline
Newbie Poster
 
0
  #3
Nov 4th, 2009
Originally Posted by ofoman View Post
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:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. function check_form()
  2. {
  3. if (document.getElementById('the_other_checkbox_id').checked==true)
  4. if(document.getElementById('the_textbox_id').value=="")
  5. alert('something');
  6. else
  7. go_to_next_question();
  8. }
Reply With Quote Quick reply to this message  
Reply

Message:




Views: 462 | Replies: 2
Thread Tools Search this Thread



Tag cloud for JavaScript / DHTML / AJAX
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC