This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes HTML, CSS and JavaScript and the fly likes Oject Does Not Support This Property Or Method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Oject Does Not Support This Property Or Method" Watch "Oject Does Not Support This Property Or Method" New topic
Author

Oject Does Not Support This Property Or Method

Ayan Biswas
Ranch Hand

Joined: Jul 10, 2010
Posts: 104
I used the following javascript function to submit a form in the jsp page

But whenever I click the submit button I get the following error 'Oject Does Not Support This Property Or Method'.The error is in the following line
I am using IE.How would I get rid of this problem?


AyanBiswas
Nikhil Padharia
Ranch Hand

Joined: Apr 19, 2012
Posts: 37
Do you have two forms on your JSP?
If no then you will need to use

instead of
Ayan Biswas
Ranch Hand

Joined: Jul 10, 2010
Posts: 104
@Nikhil Padharia ,yes I have 2 forms in my jsp page
Nikhil Padharia
Ranch Hand

Joined: Apr 19, 2012
Posts: 37
Try debugging what value of document or document.forms[1] you are getting.
Probably one of them is null, which is creating the problem.
Ayan Biswas
Ranch Hand

Joined: Jul 10, 2010
Posts: 104
Nikhil Padharia
Try debugging what value of document or document.forms[1] you are getting.
Probably one of them is null, which is creating the problem.

No,none of them is null
Nikhil Padharia
Ranch Hand

Joined: Apr 19, 2012
Posts: 37
Ayan Biswas wrote:No,none of them is null

Are you sure?
If that is not the case then I don't think there is any reason you get this error.
What values you get for document and document.forms[1]?
Ayan Biswas
Ranch Hand

Joined: Jul 10, 2010
Posts: 104
Nikhil Padharia

Are you sure?
If that is not the case then I don't think there is any reason you get this error.
What values you get for document and document.forms[1]?

alert(document) gave [object]
alert(document.forms[1]) gave [object]
alert(document.forms[1]== null ) gave false
alert(document.forms.length); gave 2
Nikhil Padharia
Ranch Hand

Joined: Apr 19, 2012
Posts: 37
and what does document.forms[1].action gives you?
Ayan Biswas
Ranch Hand

Joined: Jul 10, 2010
Posts: 104
Nikhil Padharia
and what does document.forms[1].action gives you?

alert(document.forms[1].action==null) gives false;
Nikhil Padharia
Ranch Hand

Joined: Apr 19, 2012
Posts: 37
All this tests you are performing using the same submit button click?
Ayan Biswas
Ranch Hand

Joined: Jul 10, 2010
Posts: 104
Nikhil Padharia
All this tests you are performing using the same submit button click?

Yes
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Do you have an element on your page named action or submit? [textbox, btn, etc?]

If you do rename it.

Eric
 
 
subject: Oject Does Not Support This Property Or Method