mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
select radio button with empty value
if multiple radio button doesn't have a value, the default one is checked. This is done using javascript, currently.
This commit is contained in:
@@ -100,7 +100,7 @@ var chill = function() {
|
||||
function _generalDisplayAlertWhenLeavingForm(form_id, alert_message, check_unsaved_data) {
|
||||
var form_submitted = false;
|
||||
var unsaved_data = false;
|
||||
|
||||
|
||||
$(form_id)
|
||||
.submit(function() {
|
||||
form_submitted = true;
|
||||
@@ -121,7 +121,22 @@ var chill = function() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function checkNullValuesInChoices(choice_name) {
|
||||
var choices;
|
||||
console.log(choice_name);
|
||||
choices = $("input[name='"+choice_name+"']:checked");
|
||||
if (choices.size() === 0) {
|
||||
$.each($("input[name='"+choice_name+"']"), function (i, e) {
|
||||
if (e.value === "") {
|
||||
e.checked = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
//}
|
||||
//});
|
||||
}
|
||||
|
||||
/**
|
||||
* Display an alert message when the user wants to leave a page containing a given
|
||||
* modified form.
|
||||
@@ -164,5 +179,6 @@ var chill = function() {
|
||||
checkOtherValueOnChange: checkOtherValueOnChange,
|
||||
displayAlertWhenLeavingModifiedForm: displayAlertWhenLeavingModifiedForm,
|
||||
displayAlertWhenLeavingUnsubmittedForm: displayAlertWhenLeavingUnsubmittedForm,
|
||||
checkNullValuesInChoices: checkNullValuesInChoices,
|
||||
};
|
||||
} ();
|
Reference in New Issue
Block a user