Solved

JavaScript error Object expected.

Posted on 2004-04-21
7
74,136 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
I starting with php 12 139
Question on web subscription for apps 3 118
Adding a hidden div to each row in a table 6 95
Windows Tool to Build Android and iOS App 3 113
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…
There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

762 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