"Fabian" <la****@hotmail.com> wrote in message
news:bq*************@ID-174912.news.uni-berlin.de...
Randell D. hu kiteb:
Folks,
I have a form (called FORM1) - In my INPUT submit tag, I have an
onClick event that I have successfully tested/used to display the
value of a TEXT box using the following function (called via an
onClick event)
<script type="text/javascript">
function performPrePostChecks()
{
// myName being an iput text box
// hosted being an input radio box
h=document.form1.myName.value;
alert(h);
return false;
}
How can I read the value of a radio button like I have the text box?
At the moment, if I have it catch myName, I get the value I entered
in to the box named myName in an alert box.
When I change the function to instead catch the value of the radio
button (called hosted) - The alert box says "undefined".
Are radio buttons handled differently?
Radio buttons require an explicit VALUE attribute. CHECKED is an
optional attribute and can be used to specify which options are selected
for initial form display. The VALUE attribute for a text box is whatever
you type there, but typing is unlikely in the context of a radio button.
--
--
Fabian
Visit my website often and for long periods!
http://www.lajzar.co.uk
Okay... I'm familiar with the HTML side of my form and how to set an initial
form display - but how do I use javascript to read my radio value that a
user has selected/checked from radio buttons. My form is called FORM1 and
the following code is what I use to display the radio buttons in the first
place:
Hosted:
<input type="radio" name="hosted" value="local"> Locally
<input type="radio" name="hosted" value="remote"> Remote
randelld