N°2160: Correctly initialize fields depending on a select field with only 1 value

This commit is contained in:
Stephen Abello
2019-06-12 14:37:46 +02:00
parent 4a1be13904
commit 86a7192f5a
3 changed files with 11 additions and 0 deletions

View File

@@ -2178,6 +2178,11 @@ EOF
if ((count($aAllowedValues) == 1) && ($bMandatory == 'true'))
{
// When there is only once choice, select it by default
$oPage->add_ready_script(
<<<EOF
$('#$iId').attr('data-validate','dependencies');
EOF
);
$sSelected = ' selected';
}
else

View File

@@ -208,6 +208,11 @@ class UIExtKeyWidget
{
// When there is only once choice, select it by default
$sSelected = 'selected';
$oPage->add_ready_script(
<<<EOF
$('#$this->iId').attr('data-validate','dependencies');
EOF
);
}
else
{

View File

@@ -190,6 +190,7 @@ function ReportFieldValidationStatus(sFieldId, sFormId, bValid, sExplain)
{
// Visual feedback - none when it's Ok
$('#v_'+sFieldId).html(''); //<img src="../images/validation_ok.png" />');
$('#'+sFieldId+'[data-validate*="dependencies"]').trigger('change.dependencies').removeAttr('data-validate');
}
else
{