Commit f12effc7 authored by David_Rothstein's avatar David_Rothstein

Issue #1592688 by jgtrescazes, tstoeckler, eric.chenchao, fietserwin, Heine,...

Issue #1592688 by jgtrescazes, tstoeckler, eric.chenchao, fietserwin, Heine, stefan.r, Dmitriy.trt, lachezar.valchev, bogdan khrupa: #states can cause the form "required" mark to appear more than once on the same element
parent ab86fe48
......@@ -493,7 +493,11 @@ $(document).bind('state:disabled', function(e) {
$(document).bind('state:required', function(e) {
if (e.trigger) {
if (e.value) {
$(e.target).closest('.form-item, .form-wrapper').find('label').append('<span class="form-required">*</span>');
var $label = $(e.target).closest('.form-item, .form-wrapper').find('label');
// Avoids duplicate required markers on initialization.
if (!$label.find('.form-required').length) {
$label.append('<span class="form-required">*</span>');
}
}
else {
$(e.target).closest('.form-item, .form-wrapper').find('label .form-required').remove();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment