473,396 Members | 2,018 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Validation help

Hi,

I have a form that utilizes validation as most do via javascript. This form worked totaly fine until I needed to add a dynamic div now the validation doesn't work. It does work for the first dropdown but nothing there after. I always get the error saying [form object] is null or not an object. I need help trying to figure out how to access the ojects in this form.

Now in my body I have a <form> and it's name is form1 and I also have another <form> around a drop down and it's name is change and it closes right after the drop down. I don't want to put all of the code here because it's lengthy but I'll put some of it here so that someone can help me figure out what's going on.

Expand|Select|Wrap|Line Numbers
  1. <script>
  2. <!--
  3. function validate()
  4. {
  5.  
  6. //check to see if the drop down was selected.
  7.  
  8. len = document.form1.program.length;
  9. //alert(document.graderrors.school.length);
  10. i = 0;
  11. chosen = "none";
  12.  
  13. for (i = 0; i < len; i++) 
  14. {
  15.     if (document.form1.program[i].selected)
  16.     {
  17.  
  18.         chosen = document.form1.program[i].value
  19.         //alert(document.graderrors.school[i].value);
  20.     } 
  21. }
  22.     if (chosen == "" || chosen==0 || chosen=="none") 
  23.     {
  24.         alert('Please select your program of study');
  25.         return false;
  26.     }
  27.  
  28.  
  29.  
  30. //Check for errors
  31. if(window.document.form1.firstname.value=='')
  32. {
  33.         alert('Please fill out the First Name field');
  34.         window.document.form1.firstname.focus();
  35.         return false;
  36. else if(window.document.form1.lastname.value=='')
  37. {
  38.     alert('Please fill out the Last Name field.');
  39.     window.document.form1.lastname.focus();
  40.     return false;
....on and on with validation now on to some of the body

Expand|Select|Wrap|Line Numbers
  1. <body bgcolor="#000000" topmargin="0" leftmargin="0" onLoad="javascript:hide();">
  2. <table align="center" border="0" bgcolor="#DDE324" cellspacing="0" cellpadding="0">
  3. <tr>
  4. <td bgcolor="#20249C">
  5. <table border="0" cellspacing="0" cellpadding="0">
  6. <tr>
  7. <td align="center" valign="top" height="31" bgcolor="#20249C">
  8. <p><img border="0" src="images/eCampuslgnew.jpg" alt="Keiser University eCampus Distance Education" width="693" height="85"><br>
  9. <font face="Verdana" size="1" color="#FFFFFF">Keiser University eCampus is the online division of Keiser University, Fort Lauderdale campus</font><b><font color="#FFFFFF" face="Verdana"><br></font> <font color="#EEEAB9" face="Verdana">Keiser University Division of Online Education Inquiry
  10. Form</font><font color="#FFFFFF" face="Verdana"><br></font></b> <font size="2" color="#EEEAB9" face="Verdana">To have an Admissions Counselor contact you, please fill out the form below</font></p>
  11. </td>
  12. </tr>
  13. </table>
  14. <form name="form1" method="post" action="process_ecampus_inquiry.php">
  15. <input type="hidden" name="type" value="KU Website">
  16. <table border="1" cellpadding="0" cellspacing="0" bordercolor="#20249C" width="691" id="table1">
  17. <tr>
  18. <td bgcolor="#20249C" width="155"></td>
  19. <td bgcolor="#20249C"><span class="style19">*indicates required field</span></td>
  20. </tr>
  21. <tr bgcolor="#DCDCDC">
  22. <td valign="top" nowrap="nowrap" align="right" width="155"><span class="style21"><font size="1">Program of Study*</font></span></td>
  23. <td nowrap="nowrap" width="530">
  24. <form name="change"><span class="style21"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><select id="program" tabindex="2" onChange="reveal(this.value);" name="program">
  25. <option value="">Select A Program...</option>
  26. <option value="">+ Master's Degrees</option>
  27.  
  28. <option value="MBA">&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;Master's in Business Administration</option>
  29. <option value="">+ Bachelor Degrees</option>
  30. <option value="ACCBA">&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;Accounting, BA</option>
  31. <option value="BABA">&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;Business Administration, BA - Management</option>
  32. <option value="BABA-FIN">&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;Business Administration, BA - Finance</option>
  33. <option value="BABA-HRM">&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;Business Administration, BA - Human Resources</option>
  34.  
  35. <option value="BABA-IBT">&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;Business Administration, BA - Intl. Business</option>
  36. <option value="BABA-MKT">&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;Business Administration, BA - Marketing</option>
  37. <option value="BACJ">&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;Criminal Justice, BA</option>
  38. <option value="BAHSA">&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;Health Services Administration, BA</option>
  39. <option value="BSHS">&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;Health Science, BS</option>
  40. <option value="BAHS">&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;Homeland Security, BA</option>
  41.  
  42. <option value="BSITM">&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;Information Technology Management, BS</option>
  43. <option value="BALS">&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;Legal Studies, BA</option>
  44. <option value="MISBA">&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;Management Information Systems (MIS), BS</option>
  45. <option value="BSN">&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;Nursing, RN to BSN</option>
  46. <option value="" selected="selected">+ Associate Degrees</option>
  47. <option value="ACCAS">&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;Accounting, AA</option>
  48.  
  49. <option value="CJAA">&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;Criminal Justice, AA</option>
  50. <option value="ITAS">&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;Information Technology, AS</option>
  51. <option value="HSAAA">&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;Health Services Administration, AA</option>
  52. <option value="HS">&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;Homeland Security, AA</option>
  53. <option value="MAAS">&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;Medical Assisting, AS</option>
  54. <option value="PLAA">&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;Paralegal Studies, AA</option>
  55.  
  56. </select></font></span></form>
Now this is the div in case this is need for whatever reason

Expand|Select|Wrap|Line Numbers
  1. <div id="realtooltip" style="display: inline">
  2. <table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#20249C" bgcolor="#DCDCDC" id="table2">
  3. <tbody>
  4. <tr>
  5. <td align="middle" bgcolor="white" colspan="2">
  6. <div align="center" class="style24"><span class="style23"><strong><font size="2">Must be a U.S. licensed RN to qualify for our nursing program.</font></strong><font size="2"><br>
  7. <span class="style1">Please answer the following if you are interested in our Bachelor of Science in Nursing program.</span><br>
  8. <br>
  9. Nursing Prerequisites</font></span></div>
  10. </td>
  11. </tr>
  12. <tr>
  13.  
  14. <td></td>
  15. <td nowrap="nowrap" width="100%"></td>
  16. </tr>
  17. <tr>
  18. <td colspan="2">
  19. <table width="350" border="0" id="table3">
  20. <tbody>
  21. <tr>
  22. <td><span class="style21"><font size="1">Do you possess a current, unrestricted license to practice as a registered nurse in at least one U.S. state, including the state in which a clinical will be completed?</font></span></td>
  23. <td valign="top" nowrap="nowrap"><span class="style21"><font size="1">&nbsp;&nbsp;</font> <font size="1" face="Verdana, Arial, Helvetica, sans-serif"><input id="licensed" type="hidden" name="licensed"></font></span>
  24. <table width="138" border="0" cellspacing="0" cellpadding="0" id="table4">
  25. <tr>
  26. <td width="47"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><input id="radio" onClick="form.licensed.checked=false;form.licensed.value='yes';" type="radio" value="yes" name="licensed"></font></td>
  27. <td width="32"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">yes&nbsp;</font></td>
  28.  
  29. <td width="27"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><input id="radio2" onClick="form.licensed.checked=false;form.licensed.value='no';" type="radio" value="no" name="licensed"></font></td>
  30. <td width="32"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">no</font></td>
  31. </tr>
  32. </table>
  33. <span class="style21"><font size="1">&nbsp;</font></span></td>
  34. </tr>
  35. <tr>
  36. <td><span class="style21"><font size="1">Are you a graduate of an associate degree program or a diploma nursing program?</font></span></td>
  37. <td valign="top" nowrap="nowrap"><span class="style21"><font size="1">&nbsp;&nbsp;</font> <font size="1" face="Verdana, Arial, Helvetica, sans-serif"><input id="gpa" type="hidden" name="gpa"></font></span>
  38. <table width="138" border="0" cellspacing="0" cellpadding="0" id="table5">
  39. <tr>
  40. <td width="47"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><input id="radio3" onClick="form.gpa.value='yes';form.gpa.checked=false;" tabindex="30" type="radio" value="yes" name="gpa"></font></td>
  41. <td width="32"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">yes&nbsp;</font></td>
  42.  
  43. <td width="27"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><input id="radio4" onClick="form.gpa.value='no';form.gpa.checked=false;" tabindex="31" type="radio" value="no" name="gpa"></font></td>
  44. <td width="32"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">no</font></td>
  45. </tr>
  46. </table>
  47. </td>
  48. </tr>
  49. <tr>
  50. <td><span class="style21"><font size="1">Are you a U.S. citizen or a national or permanent resident of the U.S.?</font></span></td>
  51. <td valign="top" nowrap="nowrap"><span class="style21"><font size="1">&nbsp;&nbsp;</font> <font size="1" face="Verdana, Arial, Helvetica, sans-serif"><input id="uscitizen" type="hidden" name="uscitizen"></font></span>
  52. <table width="138" border="0" cellspacing="0" cellpadding="0" id="table6">
  53. <tr>
  54. <td width="47"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><input onClick="form.uscitizen.value='yes';form.uscitizen.checked=false;" tabindex="32" type="radio" value="yes" name="uscitizen"></font></td>
  55. <td width="32"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">yes&nbsp;</font></td>
  56.  
  57. <td width="27"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><input id="radio5" onClick="form.uscitizen.value='no';form.uscitizen.checked=false;" tabindex="33" type="radio" value="no" name="uscitizen"></font></td>
  58. <td width="32"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">no</font></td>
  59. </tr>
  60. </table>
  61. </td>
  62. </tr>
  63. </tbody>
  64. </table>
  65. </td>
  66. </tr>
  67. </tbody>
  68. </table>
  69. <layer></layer>
  70. </div>
  71.  
Feb 27 '08 #1
1 1592
acoder
16,027 Expert Mod 8TB
Now in my body I have a <form> and it's name is form1 and I also have another <form> around a drop down and it's name is change and it closes right after the drop down. I don't want to put all of the code here because it's lengthy but I'll put some of it here so that someone can help me figure out what's going on.
Don't nest form tags. You don't need the second form (change) if you're going to access 'program' using 'form1'.
Feb 28 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

21
by: Stefan Richter | last post by:
Hi, after coding for days on stupid form validations - Like: strings (min / max length), numbers(min / max value), money(min / max value), postcodes(min / max value), telefon numbers, email...
2
by: Joey P | last post by:
Hi all, I am doing a project for university whereby i have to implement a simple database related to a frozen foods company. I am having some trouble though creating a validation rule for one...
3
by: Rob Meade | last post by:
Hi all, I have a login page which has username and password fields, a login button, and 2 validation controls (one for each field) - currently I have controls to display to the summary if the...
4
by: | last post by:
Hello Guys, I am using the validation controls to validate my data. But the problem is "The page is still being posted to server". I want to get rid of the round trips to server. Are there...
2
by: Dnna | last post by:
I have a table which is bound to an Internet Explorer XML data island. I'm using ASP.NET's client-side validators for an input field in the table. The problem is that if the input fields are in...
5
by: KJ | last post by:
I need help. I have a checkbox and two textboxes on a webform. How can I validation if a person either enters something in the two textboxes OR the checkbox? I tried using a custom validator...
4
by: David Colliver | last post by:
Hi all, I am having a slight problem that hopefully, someone can help me fix. I have a form on a page. Many items on the form have validation controls attached. Also on this form are...
6
by: serge calderara | last post by:
Dear all, I have read that ASP.NET does double user input validation of control when they are place on the page. Once on teh client side and again from server side right ? Could explain how...
6
by: lists | last post by:
Hi all, I am trying to validate an XML file against an XSD schema file within a ..NET C++ program, but the validation doesn't seem to be occuring. My code is listed below. The validation...
2
by: Chad Lupkes | last post by:
Hi everyone, I need help with a simple form validation. The form I'm using has been the target of some spammers, and I'm wondering what else I can do. I have a very simple validation, checking...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.