diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2023-05-14 13:22:07 +0200 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2023-05-14 14:17:00 +0200 |
commit | aa0cbe2c82bbc2295b51357378a68da0d64a44a0 (patch) | |
tree | 8dd59b7def0636fee5dbe5de600d8bb1ef2a45b7 /forms | |
parent | 777e188e7284e658a610dc5fa86e4d8f54fd2cb7 (diff) |
tdf#155121: XML Form Document: better take into account "not required"
Change-Id: Ibebdbc52f2bd7d09ec7aa5f072efef364249a291
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151733
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'forms')
-rw-r--r-- | forms/source/xforms/binding.cxx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/forms/source/xforms/binding.cxx b/forms/source/xforms/binding.cxx index 57d3727c6b97..b9f111a7e49e 100644 --- a/forms/source/xforms/binding.cxx +++ b/forms/source/xforms/binding.cxx @@ -207,7 +207,14 @@ bool Binding::isValid() const { // TODO: determine whether node is suitable, not just whether it exists return maBindingExpression.getNode().is() && - isValid_DataType() && + ( + // tdf#155121, validity rules should be apply when field is required or + // when the field is not required but not empty + // so if the field is not required and empty, do not check validity + (! maMIP.isRequired() && maBindingExpression.hasValue() + && maBindingExpression.getString().isEmpty() ) || + isValid_DataType() + ) && maMIP.isConstraint() && ( ! maMIP.isRequired() || ( maBindingExpression.hasValue() && |