Solved

JavaScript error Object expected.

Posted on 2004-04-21
7
74,130 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
7 Comments
 
LVL 6

Expert Comment

by:Lord_McFly
Comment Utility
Change these to...

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

0
 
LVL 4

Author Comment

by:NHBFighter
Comment Utility
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
Comment Utility
Two questions :
do these functions "isWhitespace" and "warnInvalid" exist ?

Normally we give alert ("Must enter the Database login name")
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 33

Expert Comment

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

Author Comment

by:NHBFighter
Comment Utility
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
Comment Utility
Thanks for the points and grade.
0
 

Expert Comment

by:msnia
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
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 receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now