• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Help needed with IE 6.0 submit

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I've got a JSP issue that I have been completely unable to resolve. The code I'm about to paste in does not work for IE6, works with FF, Chrome, Safari and Opera. Its a simple form submit. However when I try to run this in IE 6 I keep getting a 'Object does not support this property or method'. Up front I'm only posting the apparently relevant portions. I've highlighted the problem line with *************************************
Does anyone know how to get the Object to recognise or do the submit() method in IE 6

JSP:
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please UseCodeTags to make your code readable and preserve its formatting.

As the message is a JavaScript error, I've moved this to the appropriate forum.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why not use a JavaScript library and get rid of all that browser compatibility stuff? I also noticed your <html:button> tag isn't properly closed--does the JSP even compile? Would the extension check method be better called something like "submitOnValidExtension"? There's no reason to set the form's action twice if you're only using doSubmit() as the IE6 submit function. And maybe the extension check itself could look like this:All that said, I don't know why the submit() function doesn't work for IE6--did you check to make sure that document.forms[0] is what you think it is when doSubmit is called?
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(And consider formatting more consistently, and chopping off those trailing spaces.)
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Even without the revamped valid extension method, I'd refactor a bunch of stuff to make things easier to understand, read, debug, and test:While it's not awesome (or tested), each method's purpose is more clearly defined: methods should do one thing, do it well, and do it completely.

(I also don't recall if calling a form's submit() function will also call its onsubmit handler--testing locally it didn't, so if you want prepPrice() to be called on submission you might want to check. You may just have spared us the extra code, too, in which case never mind :)
 
Chris Ingram-Reid
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey David,
Re-factored the code but still encountered the same issue in IE 6 the document object doesn't know the submit() method/function. Maybe I'll try posting this on the struts forum.

Chris
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Chris Ingram-Reid wrote:Re-factored the code but still encountered the same issue in IE 6 the document object doesn't know the submit() method/function.


Did you check to see if the object you're calling submit() on is the object you think it is like I asked?

The refactoring didn't change the code--just made it easier to understand.

Maybe I'll try posting this on the struts forum.


Why?
 
Chris Ingram-Reid
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I did. Please remember this code works in all other browser but IE6, I've never tired it in IE 7 +. so it is a valid Document object. Because html:form may not have all the properties of form for IE 6.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you have a button named submit?

Eric
 
Chris Ingram-Reid
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No there are no elements on the form named submit.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Chris Ingram-Reid wrote:Because html:form may not have all the properties of form for IE 6.


It's pretty easy to find out, no?!

And that it works in everything but IE6 is kind of the point: if the code specified for IE6 is actually executing, how did you verify that the object you're calling submit on in doSubmit() is the correct object?
 
Chris Ingram-Reid
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And that it works in everything but IE6 is kind of the point: if the code specified for IE6 is actually executing, how did you verify that the object you're calling submit on in doSubmit() is the correct object?
----

Its always the same object even in the browser specific code, doSubmit() function. I use Microsoft Script Editor to step through the Javascript code when I load the page in IE 6. It is a Document Object, at least I think it is ...

 
Chris Ingram-Reid
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I posted the topic in the Struts forum and found a solution.


Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Messages: 370


[Post New]posted Today 9:50:49 AM private message [Email]
Quote [Up]
Try this. It'll fix the problem with IE

1. document.getElementById("myForm").submit();

----------------------------------------------------------------------
Chris Ingram-Reid
Greenhorn

Joined: Mar 29, 2010
Messages: 7


[Post New]posted Today 10:08:38 AM
Quote Edit [Up]
Ha, it worked. Thanks Raj, I've been trying to solve this for (2) two week
 
Chris Ingram-Reid
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
False alarm, I was using the wrong Browser.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please don't post browser issues in the Struts forum--it's not a Struts issue.
 
Chris Ingram-Reid
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I apologize for doing so Dave, just looking for answers. The form won't submit in the most popular browser in the world, I'm still getting the same error message and I hate Microsoft.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
IE6 is not the most popular browser in the world, and hasn't been for some time:

http://www.w3schools.com/browsers/browsers_stats.asp
http://www.w3counter.com/globalstats.php

Note that verifying the object you thought you calling submit on was actually the form would have solved the problem--I wasn't just asking out of my own curiosity, I was asking the question that would have solved your problem.
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why in the world are you doing all of that funky logic to submit the form in the first place? All browsers will submit the form with document.forms[0].submit(); Code overkill there with strange object detection.




Eric
 
Chris Ingram-Reid
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Because unfortunately things are not always as they seem.

http://www.sixteensmallstones.org/ie-javascript-bugs-overriding-internet-explorers-documentgetelementbyid-to-be-w3c-compliant-exposes-an-additional-bug-in-getattributes/comment-page-1#comment-586
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure what that has to do with calling submit, though.
 
Chris Ingram-Reid
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Because with IE6 at the time of the submit() call I don't have a Form Object. This is why it doesn't recognize the submit, there's a bug in IE6.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which is what I said originally. And why didn't you have a form object? Not because document.forms[0].submit() doesn't work.
 
Chris Ingram-Reid
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Exactly In IE only, the form will disappear.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Forms don't just disappear, even in the abomination that is IE6. Why don't you believe Eric?
 
Chris Ingram-Reid
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've tried his code, its not working with my form.

And in IE the form(s) have been known to disappear.

http://remysharp.com/2007/02/10/ie-7-breaks-getelementbyid/
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which still doesn't seem to cover whatever issue it is you're having, but whatever.
 
Chris Ingram-Reid
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Object does not support this property or method. IE6 is not returning the correct element, every time.
Form disappearance doesn't cover the issue I'm having???

 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Object does not support this property or method



Please copy the rendered page source and post it here. That error is telling me that your button is named submit.

Eric
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And the actual execution path of the JavaScript. Did you *try* not having all that weird submit malarky in there?
 
Chris Ingram-Reid
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was able to resolve the problem by stripping the form to just the html:button, and the javascript code. Then adding each element one by one, eventually when I added an html:submit element the document.forms[0].submit() failed. I then added a property attribute to the html:submit element and it all works. FF, chrome, Safari, Opera and the venerable IE6.

Thanks for your help.
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Chris Ingram-Reid wrote:I then added a property attribute to the html:submit element and it all works.



So when I posted this 8 hours ago:

Eric Pascarello wrote:Do you have a button named submit?


I was right.

If you would have posted the rendered code of the page from the start with all of the mark-up, you would have had this answered in a few hours, not days. Giving the correct info from the start would have made your life easier.

Eric

 
Chris Ingram-Reid
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its just too hard getting anything across to you guys, believe whatever you want.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We do--Eric was right (I wasn't); the rendered HTML would have saved a lot of time.
 
You learn how to close your eyes and tell yourself "this just isn't really happening to me." Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic