HTML quickie (hopefully)

I have a screen with two “input” buttons on it. I want one of them to be the default button, so that if you just hit <enter> instead of clicking, it automatically follows the path of that one button.

How?

Thanks!

If you use radio buttons, you can use CHECKED to make one of the choices the default. Here’s the code:

<input type=“radio” name=“radioset” checked>Option 1
<input type=“radio” name=“radioset”>Option 2

You’ll have to javascript it to get consistent behaviour for all browsers. Netscape will submit single field forms when you press enter, but not multiple field forms. Off the top of my head, I forget how checkboxes and radio buttons influence that.

I like Mikodocs HTML guide. They even have a “how to” on this one:

http://www.idocs.com/tags/forms/index_famsupp_157.html

Of course, you will have to consider the lack of both name-value submit button pairs for your default case at the server end. I’m sure you already thought about it.

<PULPIT ACTION=RANT_FROM>

Actually, buttons don’t have a “path”, which, IMHO, is the worst misdesign in the whole HTML spec. The ACTION ought to be attached to the individual submit buttons rather than the <FORM> tag. If you like, have a “DEFAULT_ACTION” on the <FORM>. They simply missed the fact that it would be convenient to dispatch a form to different handlers for different buttons, forcing you to do all that dispatch on the server end. And if you are doing some sort of programming tool that makes it look to the user as if buttons are attached to individual URL’s, you probably wind up concocting some horrid hidden field mechanism based on the button names so that you can write a generalized dispatcher. Been there, done that, didn’t like it.

</PULPIT>

Thanks, guys(?).

The site you gave me was particularly helpful yabob, since I am using buttons, and not radio buttons.

I appreciate it!

Preach on my brother!