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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2 Radio Button or arrays to Validate.

Status
Not open for further replies.

ayh8disjob

Programmer
May 31, 2001
41
0
0
SG
Hi! I need help very badly.
how to create a validation that should not allow the same button to be selected? if the user click on button1 and then clicked on button2
ex. button1 = button2 not allowed prompt the user msg "not allowed" and will clear the value of the selected button.


<form name=Form1>
<br>
<input TYPE=&quot;radio&quot; NAME=&quot;button1&quot;>
<input TYPE=&quot;radio&quot; NAME=&quot;button1&quot;>
<input TYPE=&quot;radio&quot; NAME=&quot;button1&quot;>
<input TYPE=&quot;radio&quot; NAME=&quot;button1&quot;>
<input TYPE=&quot;radio&quot; NAME=&quot;button1&quot;>
<br>
<input TYPE=&quot;radio&quot; NAME=&quot;button2&quot;>
<input TYPE=&quot;radio&quot; NAME=&quot;button2&quot;>
<input TYPE=&quot;radio&quot; NAME=&quot;button2&quot;>
<input TYPE=&quot;radio&quot; NAME=&quot;button2&quot;>
<input TYPE=&quot;radio&quot; NAME=&quot;button2&quot;>
</p>
</form>


Thank you very much in advance.

AYh8DisJOB
 
hi,

try with the following code..

<BODY>
<script>
function checkRadio()
{
for (i=0; i<10; i++)
{
if ((document.Form1.elements[0].status) && (document.Form1.elements[5].status)){
alert(&quot;not allowed&quot;)
break;
}
}
}
</script>
<P>&nbsp;</P>
<form name=Form1>
<br>
<input TYPE=&quot;radio&quot; NAME=&quot;button1&quot; value=1>
<input TYPE=&quot;radio&quot; NAME=&quot;button1&quot; value=2>
<input TYPE=&quot;radio&quot; NAME=&quot;button1&quot; value=3>
<input TYPE=&quot;radio&quot; NAME=&quot;button1&quot; value=4>
<input TYPE=&quot;radio&quot; NAME=&quot;button1&quot; value=5>
<br>
<input TYPE=&quot;radio&quot; NAME=&quot;button2&quot; value=6>
<input TYPE=&quot;radio&quot; NAME=&quot;button2&quot; value=7>
<input TYPE=&quot;radio&quot; NAME=&quot;button2&quot; value=8>
<input TYPE=&quot;radio&quot; NAME=&quot;button2&quot; value=9>
<input TYPE=&quot;radio&quot; NAME=&quot;button2&quot; value=10>
</p>
<input type=button onclick=checkRadio()>
</form>

</BODY>




ur question is not clear..
if the above code doesn't help u..Pls..explain ur problem clearly
 
Ok. What i want to do is something like this
Sample HTML output:

Question 1
0 X 0 0
0 X 0 0
Question 2
0 X 0 0
0 0 X 0

if the answer is like Question 1 an error must be prompted to the user.
if the answer is like question 2 then its Ok.

is it possible let say i have 50 question and ranking it using a radio button 1 and 2 is there a function that i can use to validate all 50 questions.. that should have no same ranking in each questions.

Thanks :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top