Set attribute: Fix field always displayed in error in edition

Note: As mentioned in the commit introducing this, this attribute type does not fit well in the error reporting mechanism
This commit is contained in:
Molkobain
2021-03-12 14:21:19 +01:00
parent 1aa61fe29b
commit d175bca3cc

View File

@@ -2286,23 +2286,23 @@ JS
$oPage->add_dict_entry('Core:AttributeSet:placeholder');
/** @var \ormSet $value */
$sJson = $oAttDef->GetJsonForWidget($value, $aArgs);
$sEscapedJson = htmlentities($sJson, ENT_QUOTES, 'UTF-8');
$sSetInputName = "attr_{$sFormPrefix}{$sAttCode}";
$sJson = $oAttDef->GetJsonForWidget($value, $aArgs);
$sEscapedJson = htmlentities($sJson, ENT_QUOTES, 'UTF-8');
$sSetInputName = "attr_{$sFormPrefix}{$sAttCode}";
// handle form validation
$aEventsList[] = 'change';
$aEventsList[] = 'validate';
$sNullValue = '';
$sFieldToValidateId = $sFieldToValidateId.AttributeSet::EDITABLE_INPUT_ID_SUFFIX;
// handle form validation
$aEventsList[] = 'change';
$aEventsList[] = 'validate';
$sNullValue = '';
$sFieldToValidateId = $sFieldToValidateId.AttributeSet::EDITABLE_INPUT_ID_SUFFIX;
// generate form HTML output
$sValidationSpan = "<span class=\"form_validation ibo-field-validation\" id=\"v_{$sFieldToValidateId}\"></span>";
$sHTMLValue = '<div class="field_input_zone field_input_set ibo-input-wrapper ibo-input-tagset-wrapper is-error" data-validation="untouched"><input id="'.$iId.'" name="'.$sSetInputName.'" type="hidden" value="'.$sEscapedJson.'"></div>'.$sValidationSpan.$sReloadSpan;
$sScript = "$('#$iId').set_widget({inputWidgetIdSuffix: '".AttributeSet::EDITABLE_INPUT_ID_SUFFIX."'});";
$oPage->add_ready_script($sScript);
// generate form HTML output
$sValidationSpan = "<span class=\"form_validation ibo-field-validation\" id=\"v_{$sFieldToValidateId}\"></span>";
$sHTMLValue = '<div class="field_input_zone field_input_set ibo-input-wrapper ibo-input-tagset-wrapper" data-validation="untouched"><input id="'.$iId.'" name="'.$sSetInputName.'" type="hidden" value="'.$sEscapedJson.'"></div>'.$sValidationSpan.$sReloadSpan;
$sScript = "$('#$iId').set_widget({inputWidgetIdSuffix: '".AttributeSet::EDITABLE_INPUT_ID_SUFFIX."'});";
$oPage->add_ready_script($sScript);
break;
break;
case 'String':
default: