This is an automated email from the ASF dual-hosted git repository.
piotrz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new 2798153 Jewel CheckBoxValidator: Fix issue where validator added
directly to checkbox doesn't work
2798153 is described below
commit 279815395dca70315a17622ba16ff2226ed90612
Author: Piotr Zarzycki <[email protected]>
AuthorDate: Tue Aug 13 12:40:13 2019 +0200
Jewel CheckBoxValidator: Fix issue where validator added directly to
checkbox doesn't work
---
.../jewel/beads/validators/CheckBoxValidator.as | 30 +++++++++++++++++-----
1 file changed, 24 insertions(+), 6 deletions(-)
diff --git
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/CheckBoxValidator.as
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/CheckBoxValidator.as
index da018d9..eb3c0bb 100644
---
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/CheckBoxValidator.as
+++
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/CheckBoxValidator.as
@@ -56,16 +56,34 @@ package org.apache.royale.jewel.beads.validators
override public function validate(event:Event = null):Boolean {
if (super.validate(event)) {
var selectedCount:int = 0;
- var i:int = hostComponent.numElements;
- while(--i > -1) {
- var checkBox:CheckBox =
hostComponent.getElementAt(i) as CheckBox;
- if (!checkBox) continue;
+ var checkBox:CheckBox = hostComponent as
CheckBox;
+ if (checkBox)
+ {
if (checkBox.selected)
+ {
selectedCount++;
+ }
}
- if (selectedCount < required) {
+ else
+ {
+ var i:int = hostComponent.numElements;
+ while (--i > -1)
+ {
+ checkBox =
hostComponent.getElementAt(i) as CheckBox;
+ if(!checkBox) continue;
+ if(checkBox.selected)
+ {
+ selectedCount++;
+ }
+ }
+ }
+
+ if (selectedCount < required)
+ {
createErrorTip(requiredFieldError);
- } else {
+ }
+ else
+ {
destroyErrorTip();
}
}