Use Button Instead of Submit for Form

For those in the programming area, if you’re doing simple form processing of your HTML, why some people prefer buttons over submit.

Well for my personal preference, one of the good thing is that I can disable the automatic enter key that people tend to associate with forms. Well, it’s good at the same time, but it’s also sometimes good that you can limit your users from using the Enter key to submit the form if you want to do something else with it.

Getting a bit confusing, well, what is important is that by using buttons, I can forced the user to enable javascript in order to submit. Here’s how I do it.

<form name="form1" method="post" action="somepage" >
<input type='text' name='name' />
<input type='button' value='Submit This Name' 

Now if the user disables javascript, they won’t be able to process the form unless they are smart enough to change it, which most programmers and IT techies know. But this is just a small deterrent. Here’s the javascript part.

<script language="javascript">
function submitForm(thisform) {

There are lots of ways out there to force javascript control to be enabled on the form. But this is just the simplest of it all.

One Response

  1. Lasker January 18, 2009

Leave a Reply