html form change Input value based on drop-down selected

  • Follow


I have an HTML Form below that has a drop-down box where the user
selects "Monthly" or "Once".   I would like the value of the Input for
the description to change based on whether the user choose Once or
Monthly.  Can anybody help with a javascript for this?

<html>
<body>
<form name = "DonateForm" method="post" action="mailto:me@mail.com">
<select>
<option name="shopping-cart.items.item-1.subscription.period"
value="ONCE" type="text">
</option>
<option name="shopping-cart.items.item-1.subscription.period"
value="MONTHLY" type="text">
</option>

<input name="shopping-cart.items.item-1.item-description"
value="Monthly Donation" type="text">
</select>
</form>
</body>
</html>
0
Reply stv.nelson1 (24) 10/2/2009 1:48:31 AM

On 02/10/09 03:48, RCGUA wrote:
> I have an HTML Form below that has a drop-down box where the user
> selects "Monthly" or "Once".   I would like the value of the Input for
> the description to change based on whether the user choose Once or
> Monthly.

First of all, that's not a good idea. Suppose somebody entered $10.00,
and then switched his selection from "once" to "monthly". Whatever he
entered will be destroyed and overwritten by "Monthly Donation". Don't
do that.

> Can anybody help with a javascript for this?

Sure, I'll be happy to help. Could you provide us with a valid HTML
document which actually has a dropdown where "ONCE" or "MONTHLY" are
visible values? By "valid HTML" I mean a document which passes the W3C
HTML validator: <http://validator.w3.org/>. This is also explained in
the group FAQ, which you may have missed while you lurked here, because
it's only posted once a day.


cheers,
stefan
0
Reply Stefan 10/2/2009 2:17:23 AM


1 Replies
470 Views

(page loaded in 0.071 seconds)

Similiar Articles:













7/21/2012 11:27:37 PM


Reply: