Solved

JavaScript error Object expected.

Posted on 2004-04-21
7
74,134 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
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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

776 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