Forum Moderators: open

Message Too Old, No Replies

input type for an ordinary form button

"button" is not valid

         

Purple Martin

6:24 am on Oct 17, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Running a page through the HomeSite validator I got:

"button" is not valid value for the "TYPE" attribute in HTML20. Valid values for this attribute are: Dynamic expression, checkbox, hidden, image, password, radio, reset, submit, text.

I want to put an ordinary form button on a form, and use it to call a JavaScript function. "submit" and "reset" buttons will do stuff to the form (submit it and reset it, obviously). So what valid input type can I use for an ordinary form button?

keyplyr

6:37 am on Oct 17, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



This validates:

<INPUT TYPE="submit" NAME="Submit"
VALUE="Buy Now!">

<INPUT TYPE="reset"
VALUE="Clear Form">

Note: The NAME is an identifier for when you analyze the results, but is not necessary if you don't need it.

<added> Sorry, I just now understood the nature of your post. I use an image for the button in a site-search which calls an external JS (but I am using HTML 4.01 Transitional) TYPE="image" SRC="path/file.type" </added>

moonbiter

2:30 pm on Oct 17, 2002 (gmt 0)

10+ Year Member



You could also use the button [w3.org] element [htmlhelp.com].

On review: you're validating against HTML 2?

Purple Martin

10:22 pm on Oct 17, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks moonbiter, the button element is exactly what I'm after.

And no I don't validate against HTML2, I just do my preliminary as-I-code validation checks in HomeSite (it's an old version) and then use the official on-line validator before going live.

keyplyr

10:53 pm on Oct 17, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I thought you had already tried "button"

> "button" is not valid value for the "TYPE" attribute in HTML20. Valid values for this attribute are: Dynamic expression, checkbox, hidden, image, password, radio, reset, submit, text.

Purple Martin

11:03 pm on Oct 17, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'd tried the "button" attribute of the "input" element - not the "button" element ;)

keyplyr

12:41 am on Oct 18, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Well, I guess that explains it then - LOL