Fix bug for the switchable fields
Currently when a field switch to hidden, its required verification
doesn't get purged, this prevents form to be submitted.
Closes-bug: #1708601
Change-Id: I515ff048635f60610260ddfc076030e58724bf29
(cherry picked from commit 678bb64324
)
This commit is contained in:
parent
4a7cfa10dc
commit
d8277a49cb
|
@ -507,12 +507,21 @@ horizon.addInitFunction(horizon.forms.init = function () {
|
|||
|
||||
if (typeof data === "undefined" || !visible) {
|
||||
$input.closest('.form-group').hide();
|
||||
//The required verification should be removed and recorded
|
||||
if ($input.attr('required') === 'required') {
|
||||
$input.data('savedRequired', 'required');
|
||||
$input.removeAttr('required');
|
||||
}
|
||||
} else {
|
||||
//If the input is a checkbox no need to replace html for label since it has another structure
|
||||
if($input.attr('type') !== "checkbox"){
|
||||
$('label[for=' + $input.attr('id') + ']').html(data);
|
||||
}
|
||||
$input.closest('.form-group').show();
|
||||
//Add the required verification if it is required
|
||||
if ($input.data('savedRequired') === 'required') {
|
||||
$input.attr("required", "required");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue