N°2291 - Fix blinking of warning image on mandatory HTML field

This commit is contained in:
Eric
2019-06-06 12:58:47 +02:00
parent e4324cedb4
commit 7bb7a94fbc
2 changed files with 16 additions and 6 deletions

View File

@@ -2103,7 +2103,7 @@ EOF
$('#{$iId}_console_form').console_form_handler('alignColumns');
$('#{$iId}_console_form').console_form_handler('option', 'field_set', $('#{$iId}_field_set'));
// field_change must be processed to refresh the hidden value at anytime
$('#{$iId}_console_form').bind('value_change', function() { $('#{$iId}').val(JSON.stringify($('#{$iId}_field_set').triggerHandler('get_current_values'))); console.error($('#{$iId}').val()); });
$('#{$iId}_console_form').bind('value_change', function() { $('#{$iId}').val(JSON.stringify($('#{$iId}_field_set').triggerHandler('get_current_values'))); });
// Initialize the hidden value with current state
// update_value is triggered when preparing the wizard helper object for ajax calls
$('#{$iId}').bind('update_value', function() { $(this).val(JSON.stringify($('#{$iId}_field_set').triggerHandler('get_current_values'))); });

View File

@@ -200,11 +200,16 @@ function ReportFieldValidationStatus(sFieldId, sFormId, bValid, sExplain)
// Let's remember the first input with an error, so that we can put back the focus on it later
oFormErrors['input_'+sFormId] = sFieldId;
}
// Visual feedback
$('#v_'+sFieldId).html('<img src="../images/validation_error.png" style="vertical-align:middle" data-tooltip="'+sExplain+'"/>');
//Avoid replacing exisiting tooltip for periodically checked element (like CKeditor fields)
if ($('#v_'+sFieldId+' img').length == 0)
{
$('#v_'+sFieldId).html('<img src="../images/validation_error.png" style="vertical-align:middle" data-tooltip="'+sExplain+'"/>');
}
//Avoid replacing exisiting tooltip for periodically checked element (like CKeditor fields)
if($('#v_'+sFieldId).tooltip( "instance" ) === undefined)
{
// Visual feedback
$('#v_'+sFieldId).tooltip({
items: 'span',
tooltipClass: 'form_field_error',
@@ -343,8 +348,13 @@ function ValidateCKEditField(sFieldId, sPattern, bMandatory, sFormId, nullValue,
ReportFieldValidationStatus(sFieldId, sFormId, bValid, sExplain);
// We need to check periodically as CKEditor doesn't trigger our events. More details in UIHTMLEditorWidget::Display() @ line 92
setTimeout(function(){ValidateCKEditField(sFieldId, sPattern, bMandatory, sFormId, nullValue, originalValue);}, 500);
if ($('#'+sFieldId).data('timeout_validate') == undefined) {
// We need to check periodically as CKEditor doesn't trigger our events. More details in UIHTMLEditorWidget::Display() @ line 92
var iTimeoutValidate = setInterval(function () {
ValidateCKEditField(sFieldId, sPattern, bMandatory, sFormId, nullValue, originalValue);
}, 500);
$('#'+sFieldId).data('timeout_validate', iTimeoutValidate);
}
}
/*