• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

JS: Prototype.js- Event.stop doesnt work with IE

Status
Not open for further replies.

Agum

New Member
Hi all,

I have a quick question/problem.
So I have a login form. Here's my JS:

Event.observe(window, 'load', init, false);

function init()
{
Event.observe('loginForm', 'submit', loginAction);
}

function loginAction(event)
{
Event.stop(event);
// do other stuff
}

This doesn't work in IE.
It works fine in Firefox, stopping the form from submitting at that time, and run rest of the function. In IE, the form just submits. How can I fix this?

Thanks.
 
Update:

I just found out that above piece of code works, what doesn't work is what follows in the "other stuff" part, which I have this:

Code:
	var loginAjax = new Ajax.Request('/foobar/url', {
		method: 'post',
		parameters: {user: $('username').value},
		onSuccess: function(transport) {
			$('errorMsg').innerHTML = transport.responseText;
		},
		onFailure: function() {
			$('errorMsg').innerHTML = 'Failed.';
		},
		});

In FireFox, it would work fine and the errorMsg would update accordingly.
However, in IE, it just redirects to the /foobar/url page, as if AJAX is not used at all and the form just got submitted..
 
Sorry, please close thread, problem solved. It was a syntax bug. Not sure why it worked in Firefox. :p
 
Status
Not open for further replies.
Back
Top