Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Firefox, prevent submission

Status
Not open for further replies.

elliottmina

Programmer
Feb 6, 2005
12
0
0
US
I am trying to hijack an existing form and use it for a different purpose. Unfortunately I cannot just change the form itself. :(

When the form is submitted throuh clicking the submit button, or hitting the enter key on an input field, a function is called to validate the form and then allow/disallow it to submit.

After the form and javascript function, I redeclare the validation function as such:
function ShowAlert()
{
alert('hijacking search');
//set a cookie
window.location = '/sandbox/foo/bar.aspx';
return false;
}

I want to stop the form from submitting, and instead have it go to /sandbox/foo/bar.aspx. It works fine in IE, but Firefox always allows it to follow the form's action.

TIA!
 
Show us your onsubmit attribute where you call the form validation.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
Sorry for wasting your time. Looks like a unrelated script was failing and mucking it up. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top