Commit 91466083 authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic Committed by Gerrit Code Review

Merge "Bug 1756764: Alert user if shared with rules 2nd option empty"

parents 30f79e4a 55c50c1c
......@@ -1458,10 +1458,12 @@ function jsstrings() {
'toggletoolbarsoff',
'imagexofy',
'remove',
'errorprocessingform',
),
'pieforms' => array(
'element.calendar.opendatepicker',
'rule.maxlength.maxlength'
'rule.maxlength.maxlength',
'rule.required.required',
)
),
'tablerenderer' => array(
......
......@@ -108,6 +108,11 @@
line-height: $input-height-base / 2;
}
}
.input-short-error {
max-width: 205px;
display: inline-block;
width: 230px;
}
}
......
......@@ -125,13 +125,25 @@ jQuery(function($) {
$j('#{{$formname}} select:required').each(function() {
if ($j(this).val()) {
$j(this).prop("required", false);
$j(this).parent().parent().find('div.errmsg').remove();
}
else {
var b = $j(this).attr("data-type");
$j('#messages').html('<div class="alert alert-danger"><div>' + get_string('errorprocessingform', 'mahara') + '</div></div>');
if ($j(this).parent().parent().find('div.errmsg').length === 0) {
$j(this).parent().parent().append('<div class="errmsg"><span class="input-short-error"></span><span id="' + $j(this).prop('id') + '_error">' + get_string('rule.required.required', 'pieforms') + '</span></div>');
}
e.preventDefault();
e.stopPropagation();
}
});
});
// Remove 'required' on cancel
$j('#cancel_{{$formname}}_submit').click(function(e) {
$j('#{{$formname}} select:required').each(function() {
$j(this).prop("required", false);
});
});
function setDatePicker(target) {
var loc = '{{strstr(current_language(), '.', true)}}'; // Get current langauge to use for locale
......
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