zq29 Posted October 27, 2006 Share Posted October 27, 2006 I'm needing to trigger a JavaScript function "on submit" of a form, but I don't want the form submitted to the script denoted in the action attribute. As far as I was aware, this would be done by adding in a 'return false' within the 'onsubmit' attribute, like so:[code]<form name='edit_user' action='insert.php' method='post' onsubmit='sendRequest(); return false'>[/code]Although, when clicking the submit button within this form, in FireFox, it submits and goes to insert.php. In IE, it just prompts me to download insert.php...Am I missing something? Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted October 27, 2006 Share Posted October 27, 2006 maybe nothing but put the semi colon after return false.and why are you still using single quotes for html attribute values?? u naughty boy! ;) Quote Link to comment Share on other sites More sharing options...
zq29 Posted October 27, 2006 Author Share Posted October 27, 2006 [quote author=ToonMariner link=topic=112914.msg458502#msg458502 date=1161946536]maybe nothing but put the semi colon after return false.[/quote]No luck there :([quote author=ToonMariner link=topic=112914.msg458502#msg458502 date=1161946536]and why are you still using single quotes for html attribute values?? u naughty boy! ;)[/quote]Because I'm actually echo'ing that code from within some PHP, and I couldn't be arsed to escape double quotes! Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted October 27, 2006 Share Posted October 27, 2006 what a lazy toe-rag!!! Quote Link to comment Share on other sites More sharing options...
zq29 Posted October 27, 2006 Author Share Posted October 27, 2006 Not to worry now guys, the 'return false' actually was working in the first place - Something else along the line wasn't! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.