[thelist] Getting <button> to send value

Joshua Olson joshua at waetech.com
Thu Sep 26 09:02:01 CDT 2002


----- Original Message -----
From: "Craig" <cd-ml at aardvark.net.au>
Sent: Thursday, September 26, 2002 9:51 AM


> Why does <button> send the value as what's between the tag rather than
sending
> what's specified in value="" ?

I don't usually use the button tag because I'm always concerned about cross
browser compatibility.  (Does anybody have any information on which browsers
it works on?)  Since I rarely use it I don't know the answer to your
question.

But, here's a possible work around.  Use the onclick handler on the button
to set the value of a hidden text field.  Remove the name from the button
altogether.

Something like this:

<input type="hidden" name="t2" value="">
<button onclick="this.form.elements.t2.value = this.value;" value="t2value"
type="submit"><span style="text-decoration:
underline;">P</span>opulate</button>

HTH,
-joshua




More information about the thelist mailing list