mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 19:18:44 +02:00
N°2291 - Fix blinking of warning image on mandatory HTML field
This commit is contained in:
@@ -2103,7 +2103,7 @@ EOF
|
|||||||
$('#{$iId}_console_form').console_form_handler('alignColumns');
|
$('#{$iId}_console_form').console_form_handler('alignColumns');
|
||||||
$('#{$iId}_console_form').console_form_handler('option', 'field_set', $('#{$iId}_field_set'));
|
$('#{$iId}_console_form').console_form_handler('option', 'field_set', $('#{$iId}_field_set'));
|
||||||
// field_change must be processed to refresh the hidden value at anytime
|
// 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
|
// Initialize the hidden value with current state
|
||||||
// update_value is triggered when preparing the wizard helper object for ajax calls
|
// 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'))); });
|
$('#{$iId}').bind('update_value', function() { $(this).val(JSON.stringify($('#{$iId}_field_set').triggerHandler('get_current_values'))); });
|
||||||
|
|||||||
@@ -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
|
// Let's remember the first input with an error, so that we can put back the focus on it later
|
||||||
oFormErrors['input_'+sFormId] = sFieldId;
|
oFormErrors['input_'+sFormId] = sFieldId;
|
||||||
}
|
}
|
||||||
// Visual feedback
|
|
||||||
$('#v_'+sFieldId).html('<img src="../images/validation_error.png" style="vertical-align:middle" data-tooltip="'+sExplain+'"/>');
|
if ($('#v_'+sFieldId+' img').length == 0)
|
||||||
//Avoid replacing exisiting tooltip for periodically checked element (like CKeditor fields)
|
{
|
||||||
|
$('#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)
|
if($('#v_'+sFieldId).tooltip( "instance" ) === undefined)
|
||||||
{
|
{
|
||||||
|
// Visual feedback
|
||||||
|
|
||||||
$('#v_'+sFieldId).tooltip({
|
$('#v_'+sFieldId).tooltip({
|
||||||
items: 'span',
|
items: 'span',
|
||||||
tooltipClass: 'form_field_error',
|
tooltipClass: 'form_field_error',
|
||||||
@@ -343,8 +348,13 @@ function ValidateCKEditField(sFieldId, sPattern, bMandatory, sFormId, nullValue,
|
|||||||
|
|
||||||
ReportFieldValidationStatus(sFieldId, sFormId, bValid, sExplain);
|
ReportFieldValidationStatus(sFieldId, sFormId, bValid, sExplain);
|
||||||
|
|
||||||
// We need to check periodically as CKEditor doesn't trigger our events. More details in UIHTMLEditorWidget::Display() @ line 92
|
if ($('#'+sFieldId).data('timeout_validate') == undefined) {
|
||||||
setTimeout(function(){ValidateCKEditField(sFieldId, sPattern, bMandatory, sFormId, nullValue, originalValue);}, 500);
|
// 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user