Web Design and Development Forums

very basic form prefill command needed

This is a discussion on "very basic form prefill command needed" within the JavaScript Forum section. This forum, and the thread "very basic form prefill command needed are both part of the Program Your Website category.


Go Back   Webforumz.com > Program Your Website > JavaScript Forum

Welcome to Webforumz.com.
Register Now Register now!

Reply
 
LinkBack Thread Tools Rate Thread
Old Apr 15th, 2008, 21:39   #1 (permalink)
Junior Member
 
Join Date: Dec 2005
Age: 24
Posts: 43
very basic form prefill command needed

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>
__________________
Heathrow Taxis
antonyx is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old Apr 18th, 2008, 12:09   #2 (permalink)
Moderator
 
spinal007's Avatar
 
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,609
Blog Entries: 1
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
Re: very basic form prefill command needed

Try this (untested):

<p><input type="radio" value="Office to Home" name="direction"
onclick="document.getElementById('to').innerHTML = 'something';"
/>Office to Home</p>

You may also want to play around with onclick/onchange to make sure the event is fired properly in every browser
__________________
Diego - SEO Consultant London (My Blog | Fight Me)
jQuery: Star Rating - Multiple File Upload - FCKEditor/Codepress
Before we work on artificial intelligence why don't we do something about natural stupidity?
spinal007 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
basic Q reg. form -- pls advice shotokan99 HTML Forum 1 Mar 16th, 2007 11:51
Visual Basic Help Needed DJB MASTER Java, JSP, Cold Fusion 0 Nov 16th, 2006 12:47
basic form question antonyx ASP Forum 1 Aug 30th, 2006 14:18
Form Help needed! Chris PHP Forum 3 Jul 2nd, 2006 20:08



Latest Updates

All Points SEO Security Advisory - CHECK YOUR SITE NOW!

Creative Coding :: February 2008

Webforumz is sponsored by: WESH UK Web Hosting
All times are GMT. The time now is 19:13.

Sleep Study Scoring :: Free Bet :: Website Templates :: Online Betting :: Bookmakers :: Funny Quotes :: Internet Recruitment Software :: Microsoft CRM Experts :: Online Casino :: Decorated Christmas Trees :: Midwife Forums :: Football Betting :: Ecommerce Software :: Web Hosting :: Football Stats :: Dry Cleaning Collection :: xtreme wales - extreme clothing :: Apuestas :: Sharepoint Consultants :: Website Optimisation :: Office Clearance London :: Sharepoint Experts :: Sports Betting :: Casino :: Website Templates :: Web Design Development India :: Online Gambling

Powered by: vBulletin Version 3.7, Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
© 2003-2008 Webforumz.com : All Rights Reserved
Search Engine Friendly URLs by vBSEO 3.2.0 RC6


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59