473,757 Members | 10,263 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Validation help

22 New Member
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 1619
acoder
16,027 Recognized Expert Moderator MVP
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
3920
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 adresses and so on. I thought it might be a better way to programm an automated, dynamic form validation that works for all kinds of fields, shows the necessary error messages and highlights the coresponding form fields.
2
2689
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 of my fields. I have a table called "Product" and two of the fields included in this table are "Cost Price" and "Retail Price". I need to create a validation rule so that the Cost Price is always less than the Retail Price. I have tried...
3
2340
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 items missing etc.all working fine... However, when the user logs in I fire off to a stored procedure, at this point, unless the login is successful I can return up to about 8 different error numbers in a string which I then split out into an...
4
2373
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 any get arounds for this problem apart from the traditional JavaScript?
2
2685
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 a table that is bound to the island (such that the rows are dynamically generated by IE from the XML data island), the validators do not work. If the table is not bound, the validators do work, but then I don't have the table iterating through...
5
1318
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 but that is not working like I want it. Please help. I know this sounds easy but I cannot figure it out.
4
2976
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 linkbuttons which must not cause validation. I have found a setting "causeValidation" to disable the validation. Also on the page, I have a datagrid that I will edit lines on. I can click
6
1438
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 this process is exaclty working ? regards thnaks for your help
6
2735
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 event handler is not called even when the XML should valid properly against the schema. Obviously I'm missing something. Can anyone help?
2
1467
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 for blanks, and found an additional zipcode validation form here: http://javascript.internet.com/forms/val-zip-code.html I tried combining them, and it doesn't seem to be working. I'm not
0
9298
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10072
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9906
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9885
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9737
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8737
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6562
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3399
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.