Log in

View Full Version : Using Buttons..



publicjungle
07-12-2007, 02:30 PM
I would like to use a button to add info to a form field. The button would have the info contain within. It would be more like an option.

This is what I mean: I want to have several buttons on my page that are contected to a single form text field. The info that shows in the form field will come from clicking one of the buttons.

How would I go about doing this? :confused:

publicjungle
07-14-2007, 06:50 PM
Does anyone have an idea for me?

Twey
07-14-2007, 10:22 PM
You need to use Javascript:
<form action="">
<div>
<input type="text" name="textfield">
<input type="button" onclick="this.form.elements.textfield.value = this.value;" value="First Value">
<input type="button" onclick="this.form.elements.textfield.value = this.value;" value="Second Value">
<input type="button" onclick="this.form.elements.textfield.value = this.value;" value="Third Value">
</div>
</form>