473,795 Members | 3,279 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

5 New Member
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 3378
epots9
1,351 Recognized Expert Top Contributor
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 New Member
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 Recognized Expert Top Contributor
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 New Member
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 Recognized Expert Top Contributor
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 New Member
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
4525
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 sleuthing, I was able to find what serves as a document.getElementById emulator at http://www.xs4all.nl/~ppk/js/dhtmloptions.html#versionb. (Below is the code; this clever algorithm is painstakingly explained at the site above.)
4
8364
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 document.theform, but not document.thelink i can use both this.theform and this.thelink and self.theform and self.thelink.
3
1219
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 the following: <form name="form"> <input type=text name="phrase">
7
5886
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 down. So i have this statement: document.getElementById("dropdown").options.selected=true; And it gives me an error.
7
2954
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+ produciton environment ( not my choice, but when is it ever? ). the desired output is that when the end-user selects two radio buttons, one from each 'group', the form / page will open an alert window displaying the values of the radio buttons...
0
365
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 that is semicolon ";" separated. i.e. A telephone number. In RED below. How can I handle this? Thanks is advance for any help. Note: The LDAP server is not a Microsoft AD server.
3
3487
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 alert message shows the correct values are being passed in. If I hardcode var fieldVal = document.realFormName.realFieldName.value;
6
4623
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
5597
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 Tools Test PC :- .Net Framework 2
0
9672
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10435
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
10213
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
10163
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,...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.