Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Ezilon Directory   High Bandwidth Dedicated Servers   V7N Directory

Reply
 
LinkBack Thread Tools Display Modes
Old 07-11-2007, 11:02 PM   #1 (permalink)
Inactive
 
theChronic's Avatar
 
Join Date: 12-19-05
Location: Berkeley, California
Posts: 515
iTrader: 0 / 0%
Latest Blog:
None

theChronic is just really nicetheChronic is just really nicetheChronic is just really nicetheChronic is just really nicetheChronic is just really nicetheChronic is just really nicetheChronic is just really nicetheChronic is just really nicetheChronic is just really nicetheChronic is just really nicetheChronic is just really nice
Radio Button Changes What's In the Textarea

sup folks
I was wondering how I can go about changing what is in a text area or any sort of text box by selecting different radio buttons.

thnx
theChronic is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 07-12-2007, 03:08 AM   #2 (permalink)
v7n Mentor
 
Costin Trifan's Avatar
 
Join Date: 04-13-07
Location: Romania
Posts: 2,952
iTrader: 0 / 0%
Costin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web pro
Hi, John!

You can do that in many ways, depending on what technology you're using.
All you have to do is to get and display the data you need in the textbox or in the textarea whenever the state of the radio button is changed or you can use a javascript script and change the text accordingly.
__________________
JUNE - JavaScript Framework
Costin Trifan is offline  
Add Post to del.icio.us
Reply With Quote
Old 07-12-2007, 01:56 PM   #3 (permalink)
Inactive
 
theChronic's Avatar
 
Join Date: 12-19-05
Location: Berkeley, California
Posts: 515
iTrader: 0 / 0%
Latest Blog:
None

theChronic is just really nicetheChronic is just really nicetheChronic is just really nicetheChronic is just really nicetheChronic is just really nicetheChronic is just really nicetheChronic is just really nicetheChronic is just really nicetheChronic is just really nicetheChronic is just really nicetheChronic is just really nice
ok, i made some progress - i am looking for this exact thing, however, I need two of them on the same page

http://www.w3schools.com/js/tryit.as...yjs_form_radio

I tried playing around with the code and having two forms and a script for each one, changing "answer" so there are two unique ones (an "answer" and an "answer2")

It just ends up messing things up

Does anyone know how I can code two or more of those on the same page?

thnx
theChronic is offline  
Add Post to del.icio.us
Reply With Quote
Old 07-13-2007, 01:10 AM   #4 (permalink)
v7n Mentor
 
Costin Trifan's Avatar
 
Join Date: 04-13-07
Location: Romania
Posts: 2,952
iTrader: 0 / 0%
Costin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web pro
Code:
<head> <script type="text/javascript"> function check(browser) { document.getElementById("answer").value = browser } </script> </head> <body> <form id="AppMainForm"> <div> <input onclick="check(this.value)" type="radio" value="Internet Explorer" name="browser" />Internet Explorer<br /> <input onclick="check(this.value)" type="radio" value="Firefox" name="browser" />Firefox<br /> <input onclick="check(this.value)" type="radio" value="Netscape" name="browser" />Netscape<br /> <input onclick="check(this.value)" type="radio" value="Opera" name="browser" />Opera<br /> <br /> Your favorite browser is: <input id="answer" /> </div> </form> </body>
hth
__________________
JUNE - JavaScript Framework
Costin Trifan is offline  
Add Post to del.icio.us
Reply With Quote
Old 07-15-2007, 12:07 PM   #5 (permalink)
Inactive
 
theChronic's Avatar
 
Join Date: 12-19-05
Location: Berkeley, California
Posts: 515
iTrader: 0 / 0%
Latest Blog:
None

theChronic is just really nicetheChronic is just really nicetheChronic is just really nicetheChronic is just really nicetheChronic is just really nicetheChronic is just really nicetheChronic is just really nicetheChronic is just really nicetheChronic is just really nicetheChronic is just really nicetheChronic is just really nice
Isn't that the same as what was on the page I linked to ya?

What I'm trying to do is get two sets of the radio buttons & input. Any ideas on how to do this?

I tried this, but if you test it using the link below you will see how it doesn't work:
Code:
<script type="text/javascript"> function check(browser) { document.getElementById("answer").value=browser } </script> <form id="Main"> <input name="snetwork" type="radio" onclick="check(this.value)" value="Op 1"> Op 1<br /> <input type="radio" name="snetwork" onclick="check(this.value)" value="Op 2"> Op 2<br /> <input type="radio" name="snetwork" onclick="check(this.value)" value="Op 3"> Op 3<br /> <br /> Code: <input type="text" onclick="this.select();" id="answer" size="20"> </form> <script type="text/javascript"> function check(browser) { document.getElementById("answer2").value=browser } </script> <form id="Second"> <input name="snetwork2" type="radio" onclick="check(this.value)" value="Op 4"> Op 4<br /> <input type="radio" name="snetwork2" onclick="check(this.value)" value="Op 5"> Op 5<br /> <input type="radio" name="snetwork2" onclick="check(this.value)" value="Op 6"> Op 6<br /> <br /> Code: <input type="text" onclick="this.select();" id="answer2" size="20"> </form>
thanks
theChronic is offline  
Add Post to del.icio.us
Reply With Quote
Old 07-15-2007, 01:52 PM   #6 (permalink)
v7n Mentor
 
Costin Trifan's Avatar
 
Join Date: 04-13-07
Location: Romania
Posts: 2,952
iTrader: 0 / 0%
Costin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web pro
Create a different function for each form.

Code:
<form id="Main"> <script type="text/javascript"> function checkFirst(browser) { document.getElementById("answer1").value=browser; } </script> <input name="snetwork" type="radio" onclick="checkFirst(this.value)" value="Op 1" /> Op 1<br /> <input type="radio" name="snetwork" onclick="checkFirst(this.value)" value="Op 2" /> Op 2<br /> <input type="radio" name="snetwork" onclick="checkFirst(this.value)" value="Op 3" /> Op 3<br /> <br /> Code: <input type="text" onclick="this.select();" id="answer1" size="20" /> </form> <form id="Second"> <script type="text/javascript"> function checkSecond(browser) { document.getElementById("answer2").value=browser; } </script> <input name="snetwork2" type="radio" onclick="checkSecond(this.value)" value="Op 4" /> Op 4<br /> <input type="radio" name="snetwork2" onclick="checkSecond(this.value)" value="Op 5" /> Op 5<br /> <input type="radio" name="snetwork2" onclick="checkSecond(this.value)" value="Op 6" /> Op 6<br /> <br /> Code: <input type="text" onclick="this.select();" id="answer2" size="20" /> </form>
__________________
JUNE - JavaScript Framework
Costin Trifan is offline  
Add Post to del.icio.us
Reply With Quote
Old 11-02-2007, 07:18 AM   #7 (permalink)
Junior Member
 
Join Date: 11-02-07
Posts: 2
iTrader: 0 / 0%
Latest Blog:
None

Delar is liked by many
Could someone tell me what I'm doing wrong with this or if this can not be done?

Code:
<script type="text/javascript"> function check(browser) { var answer1; var answer2; document.getElementById("answer1").value=browser; answer2 = answer1; } </script> <form> <input type="radio" name="browser" onclick="check(this.value)" value="A">A<br /> <input type="radio" name="browser" onclick="check(this.value)" value="B">B<br /> <input type="radio" name="browser" onclick="check(this.value)" value="C">C<br /> <input type="radio" name="browser" onclick="check(this.value)" value="D">D<br /> <br /> <P><TEXTAREA ONCLICK="this.select();" NAME="answer1" COLS="40" ROWS="10" WRAP="physical"></TEXTAREA></P> <P><TEXTAREA ONCLICK="this.select();" NAME="answer2" COLS="40" ROWS="10" WRAP="physical"></TEXTAREA></P> </form>
When I select the radio button the answer1 is updated correctly but answer2 does not.

Last edited by Delar : 11-02-2007 at 07:21 AM.
Delar is offline  
Add Post to del.icio.us
Reply With Quote
Old 11-02-2007, 09:28 AM   #8 (permalink)
v7n Mentor
 
Costin Trifan's Avatar
 
Join Date: 04-13-07
Location: Romania
Posts: 2,952
iTrader: 0 / 0%
Costin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web pro
Code:
<head> <title>Update textareas</title> <script type="text/javascript"> function check(browser) { // Set a referrence to the objects (textarea). var answer1 = document.getElementById("answer1"); var answer2 = document.getElementById("answer2"); // Modify the value from the first textarea // whenever a radio button was checked. answer1.value = browser; // Update the second textarea with the value // found in the first textarea. answer2.value = answer1.value; } </script> </head> <body> <form> <input type="radio" name="browser" onclick="check(this.value)" value="A" />A<br /> <input type="radio" name="browser" onclick="check(this.value)" value="B" />B<br /> <input type="radio" name="browser" onclick="check(this.value)" value="C" />C<br /> <input type="radio" name="browser" onclick="check(this.value)" value="D" />D<br /> <br /> <p><textarea onclick="this.select();" name="answer1" cols="40" rows="10" wrap="physical"></textarea></p> <p><textarea onclick="this.select();" name="answer2" cols="40" rows="10" wrap="physical"></textarea></p> </form> </body>
Now, both of your textareas will update their content.
hope this helps.
__________________
JUNE - JavaScript Framework
Costin Trifan is offline  
Add Post to del.icio.us
Reply With Quote
Old 11-02-2007, 10:37 AM   #9 (permalink)
Junior Member
 
Join Date: 11-02-07
Posts: 2
iTrader: 0 / 0%
Latest Blog:
None

Delar is liked by many
Yes it does thank you!
Delar is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

vB 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
PHP - How to echo into one textarea tag ? Plz HeLp!!! nster Coding Forum 5 04-30-2007 06:11 PM
TextArea <BR> Sketch Coding Forum 2 05-05-2005 03:14 PM
HTML rich textarea ShareOurRevenue Coding Forum 2 01-11-2005 02:32 PM
<textarea> capacity? (html) Antinaris Coding Forum 1 04-24-2004 07:10 AM
Textarea problem Limit Coding Forum 6 12-20-2003 06:57 AM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 10:37 AM.
© Copyright 2008 V7 Inc