Button focus

  • Thread starter Thread starter barry
  • Start date Start date
B

barry

I was wondering why on a webform when I put the cursor into a textbox the
focus goes to the only button on the form.

thanks
 
barry said:
I was wondering why on a webform when I put the cursor into a textbox the
focus goes to the only button on the form.

Assuming that the button is of type="submit" then this is a standard event.
If you had more than one form on your page the 'focus' will appear on the
submit button associated with that form. Although it is not really a focus as
such because your focus is actually on the textbox. This allows you to press
enter whilst in the textbox to submit the form.

If you want to avoid that then you could use type="button" instead, but you
will need to created an onClick function to submit the form.
 
thanks
Geoff Willings said:
Assuming that the button is of type="submit" then this is a standard event.
If you had more than one form on your page the 'focus' will appear on the
submit button associated with that form. Although it is not really a focus as
such because your focus is actually on the textbox. This allows you to press
enter whilst in the textbox to submit the form.

If you want to avoid that then you could use type="button" instead, but you
will need to created an onClick function to submit the form.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top