View Single Post
 
Old January 23rd, 2004, 07:10 PM
joefawcett's Avatar
joefawcett joefawcett is offline
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

I see, in that case you can add a couple of lines to the top.
If you use your original code, then it's more difficult because if there are no records list will be null, if only one record then it won't be a collection and the code would fail. If you use my suggestion of document.getElementsByName then the following will work :
Code:
function capt(fields)
{
var iLength = fields.length;
if (iLength == 0)
{
alert("Ningunos expedientes encontrados.");
return;
}  
for (var i = 0; i < iLength; i++)
  {
    var oField = fields[i];
    if (oField.checked)
    {
      window.location.href="../CatLPMaestro/LPSustituidosDetalle.asp?PS_Id=" + oField.value;
      return;  
    }  
  }
  alert("Antes de ejecutar esta acción debe seleccionar una de las opciones listadas");  
}

--

Joe