|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Error, "Object Required"
I'm getting this error by double clicking the warning icon present in IE's window (bottom left). It points to line 36 and "Char 3" whatever that Char 3 means is beyond me.
Has anyone got an idea whats wrong with the following code. Code:
function __isValidEmailAddr(email)
{
var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (filter.test(email))
return true;
else
return false;
}
function __checkContactForm()
{
var _name = document.getElementById('name').value;
var _email = document.getElementById('email').value;
var _comments = document.getElementBy('comments').value;
var _errorTrigger = false;
var _errorMessage = '';
if ( _name = '' )
{
_errorTrigger = true;
_errorMessage += '\n~ You must provide a name';
}
else if ( _name.length < 3 )
{
_errorTrigger = true;
_errorMessage += '\n~ You must provide a legitimate name';
}
if ( __isValidEmailAddr(_email) == false )
{
_errorTrigger = true;
_errorMessage += '\n~ You must provide a real email address';
}
if ( _comments = '' )
{
_errorTrigger = true;
_errorMessage += '\n~ You must provide a message';
}
else if ( _comments.length < 10 )
{
_errorTrigger = true;
_errorMessage += '\n~ You must provide a legitimate message';
}
if ( errorTrigger == true )
{
alert('\nThe following error(s) were discovered prior to form submission.\n' + _errorMessage + '\n\n');
return false;
}
delete _name;
delete _email;
delete _comments;
delete _errorTrigger;
delete _errorMessage;
return true;
}
Whilst on the subject, can anyone recommend me a javascript debugger, I've only IE's error messages to go on at the moment. |
|
#2
|
||||
|
||||
|
var _comments = document.getElementById('comments').value;
And what is with all the underscores?
__________________
The liver is evil and must be punished! |
|
#3
|
||||
|
||||
|
Quote:
It means the third character on line 36. Quote:
I would suggest developing with Firefox and using either the Venkman JS debugger or (what I personally use) Firebug extensions. You still have to run everything through IE and as many other browsers as you can to make sure your code is relatively browser neutral.
__________________
BookMooch.com : Give books away. Get books you want. |
|
#4
|
||||
|
||||
|
I concur with lnxgeek, starting with IE's crap debugging tools is a waste of time. There's actually a Firebug lite, which you can use in IE and Safari to debug with... after you have finished working with Firefox.
http://www.getfirebug.com/lite.html
__________________
------------- vbrtrmn -------------- i think i'm missing some vowels here ------------------------------------ ---------- js.antinoc.net ---------- ------------------------------------ --- The Two Types of Programmers --- |
|
#5
|
|||
|
|||
|
I made some syntax errors that were driving me mad, also I also missed some comparision operators
e.g. Code:
if ( _name = '' ) instead of Code:
if ( _name == '' ) Thanks for the suggestions, I've installed those two plugins for firefox, will give them a go. Note: Has any one/company developed a dedicated IDE for javascript? |
|
#6
|
||||
|
||||
|
Quote:
hi, i have used that too, but it just shows the same error information as the IE's crap debugging tools ... ![]() so its always a pain to debug in IE
__________________
Planning is pain if the requirements are not clear -- mod_rewrite url saving application |
![]() |
| Viewing: Dev Shed Forums > Web Design > JavaScript Development > Error, "Object Required" |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|