hello, i am trying to prefill a textarea when a radio button is clicked. the value of the textarea will depend upon the value of a drop down.
here is my form.
http://www.londonheathrowcars.com/testform2.htm
what i am asking for is one very basic javascript command that does the following:
- Code: Select all
when direction.radio is clicked do
if office to home is clicked and passenger="jimmy" then from.value="office" and to.value="jimmy home"
if office to home is clicked and passenger="jonny" then from.value="office" and to.value="jonny home"
end.
that's it. once i see the syntax for doing this i can play around with it no problem.
i hope someone can help
thanks..
here is the page code
- Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Form</title>
</head>
<h1>Booking Form</h1>
<p>Welcome to the booking page.</p>
<form name="bookingenquiryform" method="post">
<p>Passenger:</p>
<p><select id="passenger" name="passenger">
<option value="">...</option>
<option value="Jimmy">Jimmy</option>
<option value="Jonny">Jonny</option>
</select>
</p>
<p><input type="radio" value="Office to Home" name="direction" />Office to Home</p>
<p>From:</p>
<p><textarea id="from" name="from" cols="45" rows="3"></textarea></p>
<p>To:</p>
<p><textarea id="to" name="to" cols="45" rows="3"></textarea></p>
<p><input value="Send Booking >>" id="confirm" name="confirm" type="submit" /></p>
</form>
</body>
</html>