473,379 Members | 1,381 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,379 software developers and data experts.

Error: document.forms[0].sec11_A has no properties

5
I'm having issues, I've spent many hours searching and I'm a noob at javascript, any help will be greatly appreciated.

I keep getting the following error:
Error: document.forms[0].sec11_A has no properties

with this script:

Expand|Select|Wrap|Line Numbers
  1. function checkform(btntype)
  2. {
  3.     var haserrors=0;
  4.     document.getElementById('e_sec11_1').style.color = "black";
  5.     document.getElementById('e_sec11_2').style.color = "black";
  6.     document.getElementById('e_sec11_3').style.color = "black";
  7.     document.getElementById('e_sec11_4').style.color = "black";
  8.     document.getElementById('e_sec11_5').style.color = "black";
  9.     document.getElementById('e_sec11_6').style.color = "black";
  10.     document.getElementById('e_sec11_7').style.color = "black";
  11.     document.getElementById('e_sec11_8').style.color = "black";
  12.     document.getElementById('e_sec11_9').style.color = "black";
  13.  
  14.     //Sec11_A
  15.     var sec11_Achecked=0;
  16.     for (i=0;i<document.forms[0].sec11_A.length;i++) {
  17.         if (document.forms[0].sec11_A[i].checked) {
  18.         sec11_Achecked=1;
  19.         }
  20.     }
  21.     if (sec11_Achecked<1) {
  22.         haserrors=1;
  23.         document.getElementById('e_sec11_1').style.color = "red";
  24.     }
  25.  
  26.     //Sec11_B
  27.     var sec11_Bchecked=0;
  28.     for (i=0;i<document.forms[0].sec11_B.length;i++) {
  29.         if (document.forms[0].sec11_B[i].checked) {
  30.         sec11_Bchecked=1;
  31.         }
  32.     }
  33.     if (sec11_Bchecked<1) {
  34.         haserrors=1;
  35.         document.getElementById('e_sec11_2').style.color = "red";
  36.     }
  37.  
  38.     //Sec11_C
  39.     var sec11_Cchecked=0;
  40.     for (i=0;i<document.forms[0].sec11_C.length;i++) {
  41.         if (document.forms[0].sec11_C[i].checked) {
  42.         sec11_Cchecked=1;
  43.         }
  44.     }
  45.     if (sec11_Cchecked<1) {
  46.         haserrors=1;
  47.         document.getElementById('e_sec11_3').style.color = "red";
  48.     }
  49.  
  50.     //Sec11_D
  51.     var sec11_Dchecked=0;
  52.     for (i=0;i<document.forms[0].sec11_D.length;i++) {
  53.         if (document.forms[0].sec11_D[i].checked) {
  54.         sec11_Dchecked=1;
  55.         }
  56.     }
  57.     if (sec11_Dchecked<1) {
  58.         haserrors=1;
  59.         document.getElementById('e_sec11_4').style.color = "red";
  60.     }
  61.  
  62.     //Sec11_E
  63.     var sec11_Echecked=0;
  64.     for (i=0;i<document.forms[0].sec11_E.length;i++) {
  65.         if (document.forms[0].sec11_E[i].checked) {
  66.         sec11_Echecked=1;
  67.         }
  68.     }
  69.     if (sec11_Echecked<1) {
  70.         haserrors=1;
  71.         document.getElementById('e_sec11_5').style.color = "red";
  72.     }
  73.     if (LEN(ALLTRIM(document.myform.sec11_6.value)) == 0) {
  74.         haserrors=1;
  75.         document.getElementById('e_sec11_6').style.color = "red";
  76.     }
  77.     if (LEN(ALLTRIM(document.myform.sec11_7.value)) == 0) {
  78.         haserrors=1;
  79.         document.getElementById('e_sec11_7').style.color = "red";
  80.     }
  81.     if (LEN(ALLTRIM(document.myform.sec11_8.value)) == 0) {
  82.         haserrors=1;
  83.         document.getElementById('e_sec11_8').style.color = "red";
  84.     }
  85.     if (LEN(ALLTRIM(document.myform.sec11_9.value)) == 0) {
  86.         haserrors=1;
  87.         document.getElementById('e_sec11_9').style.color = "red";
  88.     }
  89.  
  90.     if (btntype=="next" ) {
  91.         document.myform.btntype.value="next";
  92.     } else {
  93.         if (btntype=="back") {
  94.             document.myform.btntype.value="back";
  95.         }
  96.     }
  97.  
  98.     if (haserrors>0) {
  99.  
  100.             var answer=confirm("Are you sure you want to continue without completing the evalutation?");
  101.             if (answer) {
  102.                 document.myform.submit();
  103.             } else {
  104.                 return;
  105.             }
  106.  
  107. }
  108.  
Thanks in advance.

Lee
Jun 18 '07 #1
6 3348
epots9
1,351 Expert 1GB
if your HTML what is "sec11_A"? Which element has that as its id? and what type of element is it?
Jun 18 '07 #2
therig
5
It's for a radio button:

Expand|Select|Wrap|Line Numbers
  1. <input style="border:0px; width:15px; height:15px;" name="sec11_A" id="sec11_A" type="radio" value="1" <%=sec11_A1%> />
Jun 18 '07 #3
epots9
1,351 Expert 1GB
how many radio buttons are in the group sec11_A? if there is only one, then maybe u should change it to a checkbox, maybe that would do the trick.
Jun 18 '07 #4
therig
5
There's actually 3 in that group:
Expand|Select|Wrap|Line Numbers
  1.  <input style="border:0px; width:15px; height:15px;" name="sec11_A" id="sec11_A" type="radio" value="1" <%=sec11_A1%> />
  2.  
  3.  <input style="border:0px; width:15px; height:15px;" name="sec11_A" id="sec11_A" type="radio" value="2" <%=sec11_A2%> />
  4.  
  5.  <input style="border:0px; width:15px; height:15px;" name="sec11_A" id="sec11_A" type="radio" value="3" <%=sec11_A3%> />
  6.  
Jun 18 '07 #5
epots9
1,351 Expert 1GB
try this:
Expand|Select|Wrap|Line Numbers
  1. for (i=0;i<document.formName.sec11_A.length;i++)
  2.  
replace formName with the name of your form. u might have to change the others too.

good luck
Jun 18 '07 #6
therig
5
try this:
Expand|Select|Wrap|Line Numbers
  1. for (i=0;i<document.formName.sec11_A.length;i++)
  2.  
replace formName with the name of your form. u might have to change the others too.

good luck
Perfect.

Thanks,
Lee
Jun 18 '07 #7

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

Similar topics

6
by: 2obvious | last post by:
This is a pipe dream, I realize, but I'm trying to emulate the functionality of the W3C DOM-supported document.getElementsByTagName method under the very nightmarish Netscape 4. Through some...
4
by: Wow | last post by:
when calling a object in an html, should I use self.objectname this.objectname or document.objectname? for example, i have a form called theform and a link called thelink i can call...
3
by: Frances Del Rio | last post by:
for screen shot pls see http://www.francesdelrio.com/error.gif when viewing in netscape JS console it says 'document.phrase has no properties', which is very weird.. 'document.phrase' refers to...
7
by: debugger | last post by:
hello, Question, on page load, I populate an existing drop down with createElement and appendChild. It works fine so far. BUT I want to automatically select some option from this populated drop...
7
by: michael | last post by:
apologies in advance, as not only am i new to learning how to code javascript properly, i'm new to the groups posting thing... i am developing in firefox 1.0+, but will be working in an msie 6.0+...
0
by: Kenneth H. Young | last post by:
I am having difficulties with an LDAP client I'm writing. What I have discovered causes the error is when the client queries the LDAP server and a record contains two values entered in one field...
3
by: droesler | last post by:
I have a function that receives a form name and field name. someFunc(formName, fieldName) { var fieldVal = document.forms.elements.value; } This triggers the 'has no properties error. An...
6
by: linuxnooby | last post by:
Hi I want a form field to be selected when the page loads. But I get the error message Error: document.getElementById("ff") has no properties any ideas what I am doing wrong? code below
11
by: xenoix | last post by:
hey there, im reasonably new to C# and im currently writing a backup application which im using as a learning resource. My PC :- Visual Studio 2005 .NET Framework 2 Component Factory Krypton...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.