-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG? radio uncheckable dinamically? #168
Comments
No i can't select the first radio button whit html too, it's auto selectable only the second. here the code: <html>
<head>
<script src="js/lib/jquery-1.8.2.min.js"></script>
<link rel="stylesheet" href="css/jquery.idealforms.min.css" media="screen"/>
<script src="js/lib/jquery.idealforms.min.js"></script> <!-- removing it work -->
<head>
<body>
<form id="form-doc" method="post" action="">
<div>
<label>Tipo doc:</label>
<input type="text" name="tipo_doc" />
</div>
<div>
<label>Ruolo ditta:</label>
<label>
<input type="radio" name="ruolo_ditta" checked/>Fornitore
</label>
<label>
<input type="radio" name="ruolo_ditta" /> Cliente
</label>
</div>
<div>
<button type="submit">Salva</button>
<button id="reset" type="button">Reset</button>
</div>
</form>
<script type="text/javascript">
var options = {
onFail: function() {alert( 'fail');},
onSuccess: function() {alert( 'succes');},
inputs: {
'tipo_doc' : {
filters: 'required min max',
data: { min: 3, max: 16 },
},
'ruolo_ditta' : {
filters: 'required min',
data: { min: 1 },
},
}
};
var myform = $('#form-doc').idealforms(options).data('idealforms');
$('#reset').click(function(){
myform.reset().fresh().focusFirst();
});
myform.focusFirst();
</script>`
</body>
</html> |
Documentation is wrong for radio button. The field is required. This filter ONLY works with text inputs (text, password, textarea). For select use exclude to exclude the default option. For radio and checkbox use min: 1 which will require at least one option to be checked. But using: 'ruolo_ditta' : {
filters: 'min',
data: { min: 1 },
} or combinated whit 'required' filters (or only required filter) on idealforms option, where "ruolo_ditta" is the value of attribute name of radio elements. The form make a wrong and realy strange behavior. Deleting it, using checked on the first radio html element works good and $(this).prop('checked', true).trigger('change'); works as aspected. I suggest to verify if it's a BUG |
I just released Ideal Forms 3, please try to see if it works in the new version. You'd have to change the markup since it's not compatible with Ideal Forms 2. Once you have it setup try: $('form').idealforms({
rules: {
'ruolo_ditta': 'minoption:1'
}
}); And to check/uncheck it dynamically a $radio.click(); |
I try to fill the form this is how i create it :
and how i set this field:
I want fill my form dinamically and radio is the only field unsettable. This is the field elaborate by jq-idealform:
And here.. it's how i try to fill it, where $(this) is the first input element
first $(this) from firebug: Object[span.ideal-radio]
second $(this) from firebug: Object[span.ideal-field]
The text was updated successfully, but these errors were encountered: