Forums

Problem with radio button validation

vjmazcu 11 Sep, 2008
I have a problem with radio button validation. The form don´t validate that one opción is selected at least. I don´t have anything option like selected. The radio button code is:

<td width="50%">Tipo de visita :
<blockquote>
<div align="left">
<input type="radio" name="visita" value="VIP" id="visita">Visita importante.<br/>
<input type="radio" name="visita" value="Normal" id="visita">Visita normal.</div>
</td>
vjmazcu 11 Sep, 2008
I have this code in mooValidation.js

['validate-one-required', 'Debe elegir una de las posibles opciones.', function (v,elm) {
var p = elm.parentNode;
var options = p.getElementsByTagName('INPUT');
return $A(options).any(function(elm) {
return $F(elm);
});
}]
]);


I have changed this code for the next code:

['validate-one-required', 'Please select one of the above options.', function (v,elm) {
var p = elm.parentNode;
var options = p.getElementsByTagName('INPUT');
for(i=0; i<options.length; i++){
if(options[i].checked == true) {
return true;
}
}
}]
]);


but, the form don´t validate the radio button inputs. I don´t know if i have to do something more.

Thanks
Max_admin 11 Sep, 2008
this one should work as it has been tested by many and confirmed, try to test your form with the div container and the 2 checkboxes only and no other fields ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
vjmazcu 11 Sep, 2008
Resolved problem, the code validate tha data. I`m sorry but i think that the problem was in my code.

Thank very much
This topic is locked and no more replies can be posted.