PDA

View Full Version : Form () Radio button submit


dk4210
03-14-2003, 04:58 PM
Hello,
Does any one know how I can Implement a radio selection only form.
Here is my code. I am not sure what the form action is going to be based on the radio button selection.. I kinda think it has to have some java script or php logic { If - than } . I want it to direct the user to the appropriate page based on the radion button selection.
-------------------------------------------------

<HTML>
<HEAD>
<TITLE>Order Domain</TITLE>
</HEAD>
<BODY>
<B>ORDER FORM</B>
<FORM METHOD=GET ACTION="what is this going to be?">

<BR>
Please choose your payment method
<BR>
<BR>
<INPUT NAME="check" TYPE="Radio" VALUE="check">
By Check
<BR>
<INPUT NAME="credit" TYPE="Radio" VALUE="credit_card">
By Credut Card
<BR>
<BR>
<INPUT TYPE=SUBMIT>
</FORM>
</BODY>
</HTML>
----------------------------
Thanks , Dan

Quiet Storm
03-14-2003, 06:12 PM
Maybe something along the lines of:

onFocus="submit();"
or
onSelect="submit();"

Not quite sure, but maybe someone here can run with that...

dk4210
03-14-2003, 08:56 PM
Could you give me an example of what you mean?

Quiet Storm
03-14-2003, 09:35 PM
Something like this:

<html>
<head>
<script language="javascript">
<!--
function radioSender() {
var locations = new Array(1);
locations[0] = "checks.html";
locations[1] = "cards.html";
var radioList = document.myForm.myRadio;
for (i=0; i < radioList.length && !radioList[i].checked; i++) {}
self.location = (i < radioList.length) ? locations[radioList[i].value] : locationDefault;
}
//-->
</script>
</head>
<body>
<form name="myForm">
<input type="radio" name="myRadio" value="0" onclick="radioSender()">Checks<BR>
<input type="radio" name="myRadio" value="1" onclick="radioSender()">Cards<BR>

</form>
</body>
</html>


Working example:
http://www.angelfire.com/mo3/cbch21/TEST/ButtonSelect.html