Supressing Submit Behaviour

by Randall 3/30/2009 10:39:00 AM

Yesterday I needed to supress the submit functionality of some HtmlInputImage controls (aka <input type="submit" ... /> ) and found the answer with a bit of Googling.  I'm posting it here with what is (hopefully) a better heading for the solution.   Perhaps Google will index this page and make it easier for someone else to figure out.

In your form tag, use the following:

<form id="form1" runat="server" onsubmit="return false"

This will prevent the standard submit behaviour and allow your onclick JavaScript to run as you expected. 

Currently rated 3.0 by 5 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Related posts

Comments

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

4/23/2014 8:54:48 PM

Powered by BlogEngine.NET 1.3.1.0
Theme by Mads Kristensen

About the author

Name of author Randall Sexton
Currently a .Net developer for Bechtel Corporation in Oak Ridge, TN.

E-mail me Send mail

Calendar

<<  April 2014  >>
MoTuWeThFrSaSu
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

View posts in large calendar

Pages

    Recent comments

    Don't show

    Authors

    Categories


    Logo Credit

    My logo was taken from CodingHorror.
    Jeff Atwood © Copyright 2007

    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2014

    Sign in