Current location: Hot Scripts Forums » General Web Coding » JavaScript » Trying my nervers...new user to Javascript


Trying my nervers...new user to Javascript

Reply
  #1 (permalink)  
Old 07-08-04, 07:50 PM
rshelton rshelton is offline
Newbie Coder
 
Join Date: Jul 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Trying my nervers...new user to Javascript

Hello all, I hope someone can help me....

I have created and user page that has several drop down and radio button on it which is to be complete by the EU. Once the EU has completes all questions, the code below validate the user input after they click the submit button.

<form name="basicSOW" method="post" onSubmit="checkedRest()" action="#">

If the validation come up false, the page should alert the user that one or more questions were left unanswered (which it does). I can't seem to get the page to focus in on the incomplete question(s) nor can I get the page to retain the questions the Eu has already answered.

Can anyone help?

Last edited by rshelton; 07-08-04 at 07:53 PM.
Reply With Quote
  #2 (permalink)  
Old 07-09-04, 04:58 AM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
Do you already have a validation script? If so, could you please post it and I will make the neccessary changes. If not, could you post the form and I'll make a validation script for you.
Reply With Quote
  #3 (permalink)  
Old 07-09-04, 06:29 AM
Ethan Ethan is offline
Newbie Coder
 
Join Date: Jul 2004
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
I recommend not to put the onSubmit on the form tag, but an onClick on the submit button, and don't make it a submit button, but a button as you don't seem to be using this form data for processing on another page.
__________________
Lowterstudios.com - Webdeveloper Community

Norics.com - PHP MySQL Personal or Business Hosting - Webmaster Articles

Reversedlogic.net - Interactive Designing Site
Reply With Quote
  #4 (permalink)  
Old 07-09-04, 01:34 PM
rshelton rshelton is offline
Newbie Coder
 
Join Date: Jul 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Here is my validation script...

function checkedRest() {

if ((document.basicSOW.a2[0].checked == false) && document.basicSOW.a2[1].checked == false) {
alert("Please answer question 2. Select Yes or No");
return false;
}

if ((document.basicSOW.a3.value == "0") && (document.basicSOW.other3.value == "")){
alert("Display Error Message-a3");
return false;
}

if ((document.basicSOW.a4[0].checked == false) && document.basicSOW.a4[1].checked == false) {
alert("Please answer question 4. Select Yes or No")
return false;
}

if ((document.basicSOW.a5[0].checked == false) && document.basicSOW.a5[1].checked == false) {
alert("Please answer question 5. Select Yes or No")
return false;
}

if ((document.basicSOW.a6.value == "0") && (document.basicSOW.other6.value == "")){
alert("Display Error Message-a6");
return false;
}

if ((document.basicSOW.a7[0].checked == false) && document.basicSOW.a7[1].checked == false) {
alert("Please answer question 7. Select Yes or No")
return false;
}

if ((document.basicSOW.a8[0].checked == false) && document.basicSOW.a8[1].checked == false) {
alert("Please answer question 8. Select Yes or No")
return false;
}

if ((document.basicSOW.a9.value == "0") && (document.basicSOW.other9.value == "")){
alert("Display Error Message-a9");
return false;
}

if (document.basicSOW.a10.value == "0") {
alert("Display Error Message-a10");
return false;
}

if (document.basicSOW.a11.value == "0") {
alert("Display Error Message-a11");
return false;
}

if ((document.basicSOW.a12[0].checked == false) && document.basicSOW.a12[1].checked == false) {
alert("Please answer question 12. Select Yes or No")
return false;
}

if ((document.basicSOW.a13[0].checked == false) && document.basicSOW.a13[1].checked == false) {
alert("Please answer question 13. Select Yes or No")
return false;
}

if ((document.basicSOW.a14[0].checked == false) && document.basicSOW.a14[1].checked == false) {
alert("Please answer question 14. Select Yes or No")
return false;
}

if ((document.basicSOW.a15[0].checked == false) && document.basicSOW.a15[1].checked == false) {
alert("Please answer question 15. Select Yes or No")
return false;
}

if ((document.basicSOW.a16[1].checked == true) && (document.basicSOW.other16.value == "")){
alert("Display Error Message-a16");
return false;
}
else if ((document.basicSOW.a16[1].checked == true) && (document.basicSOW.other16.value != "")){
if (! isValidEmail(document.basicSOW.other16.value)) {
alert("Please enter a valid email address");
return false;
}
}
window.location = "expectations.asp?refNum"
}

Maybe I am doing to much.....thanks for the reply....
Reply With Quote
  #5 (permalink)  
Old 07-09-04, 01:37 PM
rshelton rshelton is offline
Newbie Coder
 
Join Date: Jul 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Ethan,

Thank you...your solution works....
Reply With Quote
  #6 (permalink)  
Old 07-09-04, 01:45 PM
Ethan Ethan is offline
Newbie Coder
 
Join Date: Jul 2004
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
So in your form put this submit button and it should work:

<input type="submit" name="submit" value="Submit" onClick=" checkedRest()" />

It should work, but I am not sure.
__________________
Lowterstudios.com - Webdeveloper Community

Norics.com - PHP MySQL Personal or Business Hosting - Webmaster Articles

Reversedlogic.net - Interactive Designing Site
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Order of vbscript and javascript in ASP marlin ASP 0 06-03-04 03:01 PM
Need Epinions-lite system in PHP & MYSQL wali001 Job Offers & Assistance 4 01-12-04 06:02 AM
help plzz in a user name field and password MaKRoF JavaScript 1 12-21-03 07:36 AM
Reaaly stuck about javascript over frames muratisik JavaScript 1 12-14-03 11:58 AM
JavaScript concurrency issue dugfresh JavaScript 0 12-09-03 01:12 PM


All times are GMT -5. The time now is 10:25 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.