Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,665
    Thanks
    6
    Thanked 1,006 Times in 979 Posts

    prevent submit button from submitting and execute onclick action instead

    Would any of you kind people please visit http://www.primacom.net/~k6531190/ml/adminCodeEdit.html, click on “add media” and then click “cancel” using Internet Explorer or Opera and compare it to Firefox or Safari, please?

    The general issue is that I have several submit buttons that perform different tasks and I want to add dynamic functionality so that clicking a certain submit button won’t submit the form right away but execute an onclick action instead. I haven’t managed to get that working without wrapping another element around the button(s) and executing the onclick action on these elements instead. And then, more specifically, in the overlay the click of the cancel button does close it alright in Firefox and Safari but it still submits the form in IE and Opera. What do I have to do to prevent this from happening? Will I have to replace the inputs completely?

    The respective JavaScript can be found in http://www.primacom.net/~k6531190/ml/js/functions.js starting in the second half of the document.
    Last edited by VIPStephan; 03-12-2010 at 06:34 PM.

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,665
    Thanks
    6
    Thanked 1,006 Times in 979 Posts
    Ah well, I ended up replacing the <input type="submit"> with an <input type="button"> which does nothing by default and allowed to add an onclick event without problems.

    Sometimes things can be so simple.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •