mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-18 14:58:43 +02:00
(Retrofit from trunk) N°606 Portal: Request template fields marked as invalid when a mandatory textarea field was empty.
SVN:2.3[4606]
This commit is contained in:
@@ -411,18 +411,30 @@ EOF
|
|||||||
break;
|
break;
|
||||||
case 'Combodo\\iTop\\Form\\Field\\TextAreaField':
|
case 'Combodo\\iTop\\Form\\Field\\TextAreaField':
|
||||||
case 'Combodo\\iTop\\Form\\Field\\CaseLogField':
|
case 'Combodo\\iTop\\Form\\Field\\CaseLogField':
|
||||||
// Overloading $sFormFieldOptions to include the set_current_value_callback. It would have been nicer to refactor the variable for all field types, but as this is a fix for a maintenance release, we rather be safe.
|
$bRichEditor = ($this->oField->GetFormat() === TextAreaField::ENUM_FORMAT_HTML);
|
||||||
$sValidators = json_encode($aValidators);
|
if($bRichEditor)
|
||||||
$oOutput->AddJs(
|
{
|
||||||
<<<EOF
|
// Overloading $sFormFieldOptions to include the set_current_value_callback. It would have been nicer to refactor the variable for all field types, but as this is a fix for a maintenance release, we rather be safe.
|
||||||
$("[data-field-id='{$this->oField->GetId()}'][data-form-path='{$this->oField->GetFormPath()}']").portal_form_field_html({
|
$sValidators = json_encode($aValidators);
|
||||||
validators: $sValidators,
|
$oOutput->AddJs(
|
||||||
set_current_value_callback: function(me, oEvent, oData){ $(me.element).find('textarea').val(oData); }
|
<<<EOF
|
||||||
});
|
$("[data-field-id='{$this->oField->GetId()}'][data-form-path='{$this->oField->GetFormPath()}']").portal_form_field_html({
|
||||||
|
validators: $sValidators,
|
||||||
|
set_current_value_callback: function(me, oEvent, oData){ $(me.element).find('textarea').val(oData); }
|
||||||
|
});
|
||||||
EOF
|
EOF
|
||||||
);
|
);
|
||||||
// MagnificPopup on images
|
// MagnificPopup on images
|
||||||
$oOutput->AddJs(InlineImage::FixImagesWidth());
|
$oOutput->AddJs(InlineImage::FixImagesWidth());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$oOutput->AddJs(
|
||||||
|
<<<EOF
|
||||||
|
$("[data-field-id='{$this->oField->GetId()}'][data-form-path='{$this->oField->GetFormPath()}']").portal_form_field($sFormFieldOptions);
|
||||||
|
EOF
|
||||||
|
);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user