PDA

View Full Version : javascript problem: form submit in ie6


deanosrs
07-10-2007, 07:44 AM
Is there something about ie 6 that stops the following piece of code working?


<a href="javascript:void(0)" onclick="document.updatecart.submit()">Update Cart</a>


Where there is a form called updatecart.

You can see this at www.cupandmug.co.uk/new.php, when you've got something in the cart go to view basket and try to update the cart or submit the order to paypal in ie6.

Any help would be greatly appreciated... I really mean that!

deanosrs
07-11-2007, 05:03 AM
Sorry to bump guys, but if anyone with javascript knowledge could kind of comment on what this might be or if they've seen it before, that would be great as the site is currently down and the client is getting pissed! cheers.

<h1>
07-11-2007, 06:44 AM
Have you tried:
<a href="#" onclick="document.updatecart.submit()">Update Cart</a>
Sometimes when the href is referencing javascript, the onclick in ignored in IE

lasting
08-19-2008, 01:35 PM
The href="#" works like magic. As an obervation to <h1> comment, the onClick is still executed, just the submit is not (try to put a function call on the onClick and some alerts inside, before the submit). This problem is gone in IE 7.

<h1>
08-19-2008, 06:42 PM
wow, oldish thread...
this should do it:

<a href="javascript:;" onclick="document.getElementById('updatecart').submit()">Update Cart</a>

Jon Hanlon
08-19-2008, 08:56 PM
The whole purpose of a link is to go somewhere else, not to submit a form.
So you should cancel the click event.

<a href="#" onclick="document.forms.updatecart.submit(); return false">Update Cart</a>