NEW The setup for mandatory field can be done on combo list too.

This commit is contained in:
Laurent Destailleur
2021-02-15 15:37:43 +01:00
parent fd5fe5b427
commit b98a654321
2 changed files with 5 additions and 2 deletions

View File

@@ -7872,7 +7872,10 @@ function printCommonFooter($zone = 'private')
// Add property 'required' on input
print 'jQuery("input[name=\''.$paramkey.'\']").prop(\'required\',true);'."\n";
print 'jQuery("textarea[name=\''.$paramkey.'\']").prop(\'required\',true);'."\n";
print 'jQuery("select[name=\''.$paramkey.'\']").prop(\'required\',true);'."\n"; // required on a select works only if key is "", this does not happen in Dolibarr
print '// required on a select works only if key is "", so we add the required attributes but also we reset the key -1 or 0 to an empty string'."\n";
print 'jQuery("select[name=\''.$paramkey.'\']").prop(\'required\',true);'."\n";
print 'jQuery("select[name=\''.$paramkey.'\'] option[value=\'-1\']").prop(\'value\', \'\');'."\n";
print 'jQuery("select[name=\''.$paramkey.'\'] option[value=\'0\']").prop(\'value\', \'\');'."\n";
}
}
}