•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the HTML and CSS section within the Web Development category of DaniWeb, a massive community of 401,446 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,913 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our HTML and CSS advertiser: Lunarpages Web Hosting
Views: 17083 | Replies: 1
![]() |
| |
•
•
Join Date: Nov 2004
Posts: 12
Reputation:
Rep Power: 4
Solved Threads: 0
I am using the following code to validate radio buttons. it work fine as long as i have more than one record returned from my recordset that creates the radio buttons dynamically. When I have one record in the recordset, this code fails... any help would be appreciated.
function validateSelect(form){
var return_var = false
myOption = -1;
for (i=0; i<document.process_form.select_record.length; i++) {
if (document.process_form.select_record[i].checked) {
myOption = i;
alert("my Option = " + MyOption);
}
}
if (myOption == -1) {
alert("You must select a Product Usage record to Update.");
return false;
} else {
return_var = true
}
}
function validateSelect(form){
var return_var = false
myOption = -1;
for (i=0; i<document.process_form.select_record.length; i++) {
if (document.process_form.select_record[i].checked) {
myOption = i;
alert("my Option = " + MyOption);
}
}
if (myOption == -1) {
alert("You must select a Product Usage record to Update.");
return false;
} else {
return_var = true
}
}
•
•
Join Date: Nov 2004
Location: Dallas, TX [USA]
Posts: 9
Reputation:
Rep Power: 0
Solved Threads: 0
if there is not an item in the record, then length is not defined.
try:
var _len=document.form.item.length?document.form.item.length:0;
Then if it is 0 you know its not an array.
1000s of Free Javascripts
try:
var _len=document.form.item.length?document.form.item.length:0;
Then if it is 0 you know its not an array.
1000s of Free Javascripts
![]() |
•
•
•
•
•
•
•
•
DaniWeb HTML and CSS Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- How to retrieve data from a dynamically generated radio button (ASP.NET)
- radio button (ASP.NET)
- Want to use radio button or menu bar instead of combo box (Java)
- Am not able to get a radio button selection to display in output (PHP)
- Security Settings -> Java permission -> Custom (radio button) -> Java Custom Settings (Web Browsers)
- Problem passing value from radio button to second page. (PHP)
Other Threads in the HTML and CSS Forum
- Previous Thread: Help Java Error "Java not found"
- Next Thread: Want script to make an email form


Hybrid Mode