« SVN RSS and Atom feeds | Main | PEAR iCal library »
November 07, 2006
Getting the checked radio button when there's only one
If I only have one radio button, JS decides it ain't a list and won't give you a length for it, so you have to trap for this:
limit = document.forms[1].customer_id.length; if(limit){ for(i = 0; i < limit; i++){ if(document.forms[1].customer_id[i].checked == true){ this_id = document.forms[1].customer_id[i].value; } } } else { this_id = document.forms[1].customer_id.value; } window.opener.document.location='index.php?customer_id=' + this_id; window.close();
Tags: JavaScript
Posted by pj at November 7, 2006 04:01 PM