Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Default submit button highlighted, choose another as default.

Status
Not open for further replies.

Knexo10

IS-IT--Management
Feb 12, 2002
20
0
0
AU
I have a form that sends an email to me. The user has to enter information into fields on the form. This all works well the problem is that if the user hits return after typing in their name then the form posts straight away, without the other fields getting filled in.

Is there a way to disable the submit button as the default action for pressing return or selecting which button is the default button?

I tried adding a reset button, but I couldn't get it to be the default selected button.

I tried looking at the code on this very page because the Preview Post button is the default not the Submit Post button. How do you select which one it will be?
 
Preview post will be an input type="submit" and Submit post will be input type="button"
 
Hi Knexo10,

I think the best way is to add an client-site (javascript)form validation and activate it with the onsubmit event.
<Form onsubmit=&quot;YourValidateFunction()&quot;>

Do some Key-word searches on the javascript forum. I'm sure you find what you want.

BTW, I don't think you want the reset button as default !! That's a lot more annoying for your clients after filling in their form. I think that will be their last visit to your site !!

Erik <!-- My sport: Boomerang throwing !!
This year I will participate at the World Championships in Germany. (!! Many Happy Returns !! -->
 
Actually, my mistake. The example in these forums you mentioned uses two submit buttons, both with the same name but different values. They submit the form to the same place, where the difference between the buttons' values is determined server side and the output given accordingly. The &quot;Preview Post&quot; is the default because it is the first one.

However, you could do it client side with a mixture of Submits, Buttons and javascript.
 
This is pretty simple, but I am drawing a blank....

I have a display of four radio buttons, what is the html code to make Selection 1 as the default selection?

<tr>
<td>
<input type=&quot;radio&quot; name=&quot;AppForm_Status&quot; value=&quot;1&quot;>
Selection 1
</td>
</tr>
<tr>
<td>
<input type=&quot;radio&quot; name=&quot;AppForm_Status&quot; value=&quot;2&quot;>
Selection 2
</td>
</tr>
<tr>
<td>
<input type=&quot;radio&quot; name=&quot;AppForm_Status&quot; value=&quot;3&quot;>
Selection 3
</td>
</tr>
 
sorry about my post - I wanted to start a new thread...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top