Jump to content


Photo

return false


  • Please log in to reply
4 replies to this topic

#1 Kris

Kris
  • Staff Alumni
  • Advanced Member
  • 2,755 posts
  • LocationThe Internet

Posted 27 October 2006 - 10:37 AM

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:
<form name='edit_user' action='insert.php' method='post' onsubmit='sendRequest(); return false'>
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?

#2 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 27 October 2006 - 10:55 AM

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! ;)
follow me on twitter @PHPsycho

#3 Kris

Kris
  • Staff Alumni
  • Advanced Member
  • 2,755 posts
  • LocationThe Internet

Posted 27 October 2006 - 10:59 AM

maybe nothing but put the semi colon after return false.

No luck there :(

and why are you still using single quotes for html attribute values?? u naughty boy! ;)

Because I'm actually echo'ing that code from within some PHP, and I couldn't be arsed to escape double quotes!

#4 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 27 October 2006 - 11:30 AM

what a lazy toe-rag!!!
follow me on twitter @PHPsycho

#5 Kris

Kris
  • Staff Alumni
  • Advanced Member
  • 2,755 posts
  • LocationThe Internet

Posted 27 October 2006 - 01:50 PM

Not to worry now guys, the 'return false' actually was working in the first place - Something else along the line wasn't!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users