Solved

JavaScript error Object expected.

Posted on 2004-04-21
7
74,140 Views
Last Modified: 2011-08-18
Hi I don't know much java script, here is some code I'm trying out
function validate(){
      var user = document.optionsForm.user.value;
      alert(user);
->      if(isWhitespace(user)){
            warnInvalid("Must enter the Database login name");
            return false;
      }
      var pw1=document.optionsForm["password1"].value;
      var pw2=document.optionsForm["password2"].value;
      alert(pw1,pw2);
      if(pw1==pw2){
            return true;
      }
      else{
            warnInvalid("The passwords entered do not match");
            return false;
      }
}

The html document has a form optionsForm with inputs user password1 and password2. onsubmit of the for this function is called. When I fill out the fields and press submit I'm getting a Object expected error. it says the error is coming form line 9 which is the isWhitespace(user) line. But when the alert box goes or it has displays the correct value? I'm not sure what is happening.
Any Ideas?

Thanks
David
0
Comment
Question by:NHBFighter
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 6

Expert Comment

by:Lord_McFly
ID: 10885215
Change these to...

     var pw1=document.optionsForm.password1.value;
     var pw2=document.optionsForm.password2.value;

0
 
LVL 4

Author Comment

by:NHBFighter
ID: 10885225
Thanks for the fast reply!
I tried that but its not even getting that far. I placed an alert right before those line and its not reached.
0
 
LVL 33

Accepted Solution

by:
sajuks earned 400 total points
ID: 10885274
Two questions :
do these functions "isWhitespace" and "warnInvalid" exist ?

Normally we give alert ("Must enter the Database login name")
0
Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

 
LVL 33

Expert Comment

by:sajuks
ID: 10885281
Remember Javascript is case-sensitive. So check for uppercase/lowercase in function names.
Hope that helps
0
 
LVL 4

Author Comment

by:NHBFighter
ID: 10885342
That was it!  isWhitespace and warnInvalid are in FormChek.js from netscape. But i didn't include it in my code.

Thanks
0
 
LVL 33

Expert Comment

by:sajuks
ID: 10885355
Thanks for the points and grade.
0
 

Expert Comment

by:msnia
ID: 11034834
i want to know that how can i remove default icons from the system tray using vbscript in html.i use this script to creat the object on my system tray but i want to remove an object/icon which is already on system tray.
<script>
function MsngrCreateObj() {
MsngrObj=new ActiveXObject("MSNMessenger.HotmailControl");
</script>
<SCRIPT event=onload for=window language=vbscript>
on error resume next
dim MsngrObj
set MsngrObj = CreateObject("the name")
If Err.Number <> 0 Then

Else
MsngrCreateObj
ExecuteGlobal "MIR"
End if
</SCRIPT>

but i want to remove or delete the icon.any icon of my choice so plz help me send me the source which can i use in my web page thanx
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question