|
-
Nov 6th, 2001, 08:01 PM
#1
Thread Starter
Fanatic Member
deselect all radio buttons when other one is clicked?
i put a few radio buttons on a form but when i click more then one they all stay selected. how can i make them deselect when a different one is clicked?
-
Nov 6th, 2001, 08:19 PM
#2
<form method="POST" action="Whatever">
<p><input type="radio" value="V1" name="R1"></p>
<p><input type="radio" value="V2" name="R1"></p>
<p><input type="radio" value="V3" name="R1"></p>
<p><input type="radio" value="V4" checked name="R1"><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>
Make sure all of the radio buttons on the form have the same name, "R1" In this example.
-
Nov 6th, 2001, 08:54 PM
#3
Thread Starter
Fanatic Member
how do i figure out which one is checked?
-
Nov 7th, 2001, 11:43 AM
#4
<%
x = Request.form("R1")
%>
x will be the value of the radio button selected
If the first radio button is selected then x will be
equal to "V1"
This is a VBScript Example I'm sure some one here knows the javascript code. I don't off the top of my head.
-
Nov 7th, 2001, 05:22 PM
#5
Thread Starter
Fanatic Member
how do i use vbscript in a web page? do i just type it in with the HTML and javascripts?
also if i am using a textarea how can i tell if someone presses return? when i add it on to a url it just string it all together.
-
Nov 20th, 2001, 09:16 AM
#6
Here perhaps this code can bring you an idea how to use mutiply controls with indexes and how to catch the key event of your browser.
Code:
<html>
<head>
<title></title>
<script language=javascript>
<!--
function Continue_onclick() {
for ( i=0; 0<rd.length; i++ ) {
if ( rd[i].checked == true ) {
alert ( 'You have selected ' + rd[i].value );
break;
}
}
}
function document_onkeydown() {
var sEnter = '13';
if ( window.event.keyCode.toString() == sEnter ){
alert ( 'You have pressed the Enter key!' );
}
}
//-->
</script>
<script language=javascript for=document event=onkeydown>
<!--
document_onkeydown()
//-->
</script>
</head>
<body>
<table id="oTable" name="oTable">
<tr>
<td>
<input type="radio" id="rd" name="rd" value="Red" checked>Red<br>
<input type="radio" id="rd" name="rd" value="Green">Green<br>
<input type="radio" id="rd" name="rd" value="Blue">Blue<br>
<input type="radio" id="rd" name="rd" value="Black">Black
</td>
</tr>
<tr>
<td>
<input type="button" value="Button" id="Continue" name="Continue" LANGUAGE=javascript onclick="return Continue_onclick()">
</td>
</tr>
</table>
</body>
</html>
-
Nov 21st, 2001, 03:11 AM
#7
Lively Member
Ok this is the client but how do I get these values at the server side?
Thanks
-
Nov 21st, 2001, 03:17 AM
#8
You can use Request("rd") to get the values. But i think you need to split up the string.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|