Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 27th, 2007, 05:09 AM
Registered User
 
Join Date: Nov 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default asp radio button array validation

HI

I want to validate a form which has approx 36 fields in which I accpt the reponses from radio button (yes/NO/NA). I need to know the Javascript which would validate all the 36 field radio buttons in an array and return the pointer where the radio button was left and not selected.
-----------------
<td width="68" align="center"><input type="radio" value="1" name="OP_1" onClick=0></td>
        <td width="68" align="center"><input type="radio" value="2" name="OP_1" onClick=0></td>
        <td width="69" align="center"><input type="radio" value="0" name="OP_1" onClick=0></td>
        <td type "hidden" width="5" align="center">
-------------------
<td width="68" align="center"><input type="radio" value="1" name="OP_2"></td>
        <td width="68" align="center"><input type="radio" value="2" name="OP_2"></td>
        <td width="69" align="center"><input type="radio" value="0" name="OP_2"></td>
--------------
<td width="68" align="center"><input type="radio" value="1" name="OP_3"></td>
        <td width="68" align="center"><input type="radio" value="2" name="OP_3"></td>
        <td width="69" align="center"><input type="radio" value="0" name="OP_3"></td>
---------

The above examples state 3 fields, there are 33 more like this.
Please help


Reply With Quote
  #2 (permalink)  
Old April 11th, 2007, 11:51 AM
Authorized User
 
Join Date: Jan 2007
Location: , , USA.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to jonsey Send a message via Yahoo to jonsey
Default

here is a JavaScript that would look for all the radio button and see what there status is if emptyl/unchecked it would simply say please check all radio buttons.


Code in JavaScript

for (i=0, n=theForm.radios.length; i<n; i++) {
if (theForm.radios[i].checked) {
     var checkvalue = theForm.radios[i].value;
     break;
}
}
why += checkRadio(checkvalue);

function checkRadio(checkvalue) {
var error = "";
if (!(checkvalue)) {
     error = "Please check a radio button.\n";
    }
return error;
}
Reply With Quote
  #3 (permalink)  
Old April 11th, 2007, 06:58 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

steve1234

My 2cents worth - Most people look at radio button and assume limited selections should be made. IMO checkboxes should be used if you would like many selections. Am I a bit old school, or is this still the case?

Wind is your friend
Matt
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
validation in radio buttons MunishBhatia ASP.NET 2.0 Professional 5 December 11th, 2007 11:15 AM
radio button anwarraja Javascript 3 September 18th, 2007 08:18 PM
Validation Radio Buttons jonsey Classic ASP Professional 1 June 6th, 2007 11:48 PM
Button acts depending on radio button values janise Access 4 March 10th, 2004 12:53 AM



All times are GMT -4. The time now is 03:34 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.