Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP WITH A JAVASCRIPT

Status
Not open for further replies.

ADEMAR

Programmer
Apr 20, 2002
43
US
Hello,
I have the following script in my page that takes the value of a radio button and places value into a text box. I need to add to this script to have another selection (pairing) of radio buttons to take the result from the previous pairing a place its value into text box2.

Code Is:

<SCRIPT LANGUAGE=&quot;JavaScript&quot; TYPE=&quot;text/javascript&quot;>
<!--
function doText(valVar)
{
document.TestForm.FillMe.value = valVar
}
//-->
</SCRIPT>
</head>
<body>
<form name=&quot;TestForm&quot;>
500 &nbsp;<input type=&quot;radio&quot; name=&quot;Cost&quot; value=&quot;500&quot; onClick=&quot;doText(this.value)&quot;><br>
550 &nbsp;<input type=&quot;radio&quot; name=&quot;Cost&quot; value=&quot;550&quot; onClick=&quot;doText(this.value)&quot;><br><br>
<input type=&quot;text&quot; name=&quot;FillMe&quot; value=&quot;&quot;>
<form>

</body>
</html>

Example in WYSWG of what I need:

buttons:
o 500
o 550

(User checks 500 button)

(Text Box1 now reads 500)

New Group Pairing of radio buttons

o Yes
o No

If Yes I need result of 1st text box to appear in text box 2

Any help is greatly appreciated,
Adam
 
<html>
<head>
<SCRIPT LANGUAGE=&quot;JavaScript&quot; TYPE=&quot;text/javascript&quot;>
<!--
function doText(valVar)
{
document.TestForm.FillMe.value = valVar
}
function doText2()
{
document.TestForm.txt2.value = document.TestForm.FillMe.value
}

//-->
</SCRIPT>
</head>
<body>
Example in WYSWG of what I need:

buttons:
o 500
o 550

(User checks 500 button)

(Text Box1 now reads 500)

<form name=&quot;TestForm&quot;>
500 <input type=&quot;radio&quot; name=&quot;Cost&quot; value=&quot;500&quot; onClick=&quot;doText(this.value)&quot;><br>
550 <input type=&quot;radio&quot; name=&quot;Cost&quot; value=&quot;550&quot; onClick=&quot;doText(this.value)&quot;><br><br>
<input type=&quot;text&quot; name=&quot;FillMe&quot; value=&quot;&quot;><br>
Yes <input type=&quot;radio&quot; name=&quot;yes&quot; value=&quot;yes&quot; onClick=&quot;doText2()&quot;><br>
No <input type=&quot;radio&quot; name=&quot;no&quot; value=&quot;no&quot;><br>
<input type=&quot;text&quot; name=&quot;txt2&quot; value=&quot;&quot;>
<form>

</body>
</html>
admin@onpntwebdesigns.com
 
one mistake in my code change to this in the lines radios
so they cannot check both


Yes <input type=&quot;radio&quot; name=&quot;yesno&quot; value=&quot;yes&quot; onClick=&quot;doText2()&quot;>
No <input type=&quot;radio&quot; name=&quot;yesno&quot; value=&quot;no&quot;><br>
admin@onpntwebdesigns.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top