Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Javascript validation for ASP form fields - HELP!

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,37771
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> Javascript validation for ASP form fields - HELP!
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Javascript validation for ASP form fields - HELP! - 9/14/2006 7:30:44 AM   
  riedellphi

 

Posts: 7
Score: 0
Joined: 9/11/2006
Status: offline
I am making a Javascript for validating some form fields on an ASP page.

I am having trouble with the red text below.  What i want it to do is check to see if either of the two radio buttons (Payroll) are checked.  If not, then flg==2 alarts them to fill out pernr text field.   Then, if the first radio button is checked, then I need to have them fill out a text field called pernr.


<script ID="clientEventHandlersJS" LANGUAGE="javascript">
function val()
{
     flg=0;
     if (document.form1.Year.selectedIndex == ""){flg=1;}
     if (document.form1.Year.selectedIndex == "Select one:"){flg=1;}
     if (document.form1.fName.value == ""){flg=1;}
     if (document.form1.lName.value == ""){flg=1;}
     if (document.form1.SSN.value == ""){flg=1;}
      if (!document.form1.Payroll[0].checked && !document.form1.Payroll[1].checked){flg=1;}
     if (!document.form1.Payroll[0].checked && document.form1.pernr.value == ""){flg=2;}
      if (flg==1){
         alert("All required fields need to be filled in")
      if (flg==2){
         alert("Because you selected Regular Payroll, you must enter your Personnel Number.");

    }else{
         document.form1.submit();
    }
}
</script>



Any help would be appreciated.
Thanks!
 
 
Post #: 1
 
 RE: Javascript validation for ASP form fields - HELP! - 9/15/2006 2:36:52 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
Perhaps asking this question at a JavaScript forum would help. You may get help here, but this is a VBScript forum.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to riedellphi)
 
 
Post #: 2
 
 RE: Javascript validation for ASP form fields - HELP! - 9/16/2006 4:50:21 AM   
  Snipah


Posts: 1343
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
Hey, Scripting Guy! version:

http://www.microsoft.com/technet/scriptcenter/resources/qanda/nov04/hey1101.mspx




_____________________________

For more information, please see the "Read me First" topic.

http://www.visualbasicscript.com

(in reply to riedellphi)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> Javascript validation for ASP form fields - HELP! Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts