473,396 Members | 1,608 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.

IE6 Null or not an Object error

Hi,
I need to have a form button disabled until the user enters a valid email address. I get the following error message in IE6

'document.community.EMAIL' is null or not an object

Not great at javascript, and any help would REALLY be appreciated.
TIA

---

Code follows:

[HTML]function checkifempty(){

var email_pattern = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var button = document.getElementById("imageField");
var field_value = document.community.EMAIL.value;

if ( (document.community.EMAIL.value == "") || (email_pattern.test(field_value) == false) ) {
button.disabled=true;
return false;
} else {
button.disabled=false;
}
}

if (document.all || document.getElementById) {
setInterval("checkifempty()",100);
}

function emailcheck(form) {
if (document.community.EMAIL.value == "" || document.community.EMAIL.value.indexOf('@', 0) == -1)
alert("Sorry, we cannot process that request. Please try again.");
}

</script>[/HTML]
Sep 4 '08 #1
4 1687
Dormilich
8,658 Expert Mod 8TB
Hi Tia,

I need to see the html code too, in case there went something wrong with the naming (you can't see those issues in the script code).

regards
Sep 4 '08 #2
Awesome, thanks! I stripped all doctypes and css..
Code follows (I hope I did it right this time)

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. <script type="text/javascript">
  4.  
  5. function checkifempty(){
  6.  
  7.     var email_pattern = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
  8.     var button = document.getElementById("imageField");
  9.     var field_value = document.community.EMAIL.value;
  10.  
  11.     if ( (document.community.EMAIL.value == "") || (email_pattern.test(field_value) == false) ) {
  12.         button.disabled=true;
  13.         return false;
  14.     } else {
  15.         button.disabled=false;
  16.         }
  17.     }
  18.  
  19.     if (document.all || document.getElementById) {
  20.         setInterval("checkifempty()",100);
  21.     }
  22.  
  23. function emailcheck(form) {
  24.     if (document.community.EMAIL.value == "" || document.community.EMAIL.value.indexOf('@', 0) == -1)
  25.         alert("Sorry, we cannot process that request. Please try again.");
  26.     }
  27.  
  28. </script>
  29.  
  30.  
  31. <script src="http://recp.mkt32.net/ui/library/formValidate.js" type="text/javascript" language="javascript"></script>
  32. </head>
  33.  
  34. <body>
  35.  
  36. <form name="community" id="community" method="post" action="http://recp.mkt32.net/servlet/UserSignUp?f=112214&postMethod=HTML&m=0&j=MAS2">
  37.     <input type="hidden" name="EMAIL_REQUIRED" value="T" />
  38.     <input type="hidden" name="EMAIL_DATATYPE" value="" />
  39.  
  40.     <label for="EMAIL">Sign up for e-mail updates.</label>
  41.  
  42.     <input type="text" name="EMAIL" id="EMAIL" value="" size="20" maxlength="4000" />
  43.     <input type="image" name="imageField" id="imageField" src="graphics/btn_green_submit.gif" alt="Submit" />
  44. </form>
  45.  
  46. </body>
  47. </html>
  48.  
  49.  
  50.  
Sep 4 '08 #3
It looks like the issue is that IE6 parses the head first, and doesn't recognize the form in the body. If I physically move the script after the form, I no longer get the error. Does this sound correct?

If anyone has any input about this, or other ways to do it, it would be great!

Now with the JS on the page, I'll get validation errors....grrr! IE6!
Sep 4 '08 #4
acoder
16,027 Expert Mod 8TB
It's probably caused by this line:
Expand|Select|Wrap|Line Numbers
  1. setInterval("checkifempty()",100);
Call it onload instead.
Sep 4 '08 #5

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

Similar topics

1
by: David C. allen | last post by:
I have created a simple Client-side SOAP Extension for a webclass that I have. When I apply the extension attribute to the the calling function in the proxy class I get an error 'Value cannot be...
5
by: David Sworder | last post by:
Hi, I've created a UserControl-derived class called MyUserControl that is able to persist and subsequently reload its state. It exposes two methods as follows: public void Serialize(Stream...
2
by: I am Sam | last post by:
I keep getting the following exception error: Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request....
7
by: wrytat | last post by:
How do I check if an object is null in vb? I tried using IsDBNull but it doesn't work at all. It gives me this error when I try statement like If Not IsDBNull(theStock.WIPQty) Then: Object...
2
by: Jim McGivney | last post by:
In asp 2.0 I am trying to insert a row using a detailsview control connected to an accessDataSource. I get the error message below. I am having trouble identifing which data field is causing the...
3
by: Jon L | last post by:
Hi, I'm hoping someone can help me with this problem. I'm not sure whether the problem lies with the software or with my understanding of the language. I'm using the Microsoft.XMLDOM object...
9
by: Francois Grieu | last post by:
When running the following code under MinGW, I get realloc(p,0) returned NULL Is that a non-conformance? TIA, Francois Grieu #include <stdio.h> #include <stdlib.h>
3
by: suganya | last post by:
Hi Some professionals already has developed the project using menu. In my company, they have given me task to clear the error in that. It is a script file named as "menubarAPI4.js" which is kept...
19
by: Michael C | last post by:
If we have something like this object x = null; MessageBox.Show(x.ToString()) we get an error. That kindof makes sense but there is no reason the behaviour couldn't be to return an empty...
10
by: =?Utf-8?B?R3JlZw==?= | last post by:
I have the following three files. 1. Users.aspx is a webpage that uses the <asp:ObjectDataSourcecontrol to populate a simple <asp:ListBoxcontrol. 2. The UserDetails.cs file creates a Namespace...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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
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...
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
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
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...
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.