This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
hi i have form with a bunch of radiobuttons with the name projectName, I found out that if there's only one radiobutton with this name, then xForm.projectName.length is undefined. If there are multiple radiobuttons with this name, then its defined. What's wrong??? thanks in advance
When you have a single radio element, the reference resolves to the single radio element. When you have multiple radio elements with the same name, the reference resolves to a list of the elements. Thus, no length property when you only have one.
so if i want to write a javscript function to loop through the list of radios on my page(to validate to see if one of them is checked). do people just usually loop through all elements of the form instead of looping through the radio element identified by the radio name?
It's rather unusual to have only one radio button on a UI. What would be the point? The whole point of radio buttons is to select one of many. For a single choice, a check box is customarily used. So it's probably not an issue that many worry about.
Joined: Apr 07, 2004
If the page is dynamic, the case where there's only one radiobutton happens frequently. eg. I list a list of projects and I can only select one to proceed, and it just so happens that at the moment i have only one project.