You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2019/03/07 15:25:22 UTC

[royale-asjs] branch develop updated: jewel-stringvalidator: solves a regression when maxlength is not defined. Also add the keyup handler only on Android devices, since the rest does not need it

This is an automated email from the ASF dual-hosted git repository.

carlosrovira 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 059f4c2  jewel-stringvalidator: solves a regression when maxlength is not defined. Also add the keyup handler only on Android devices, since the rest does not need it
059f4c2 is described below

commit 059f4c2d287916a319044dd3240246a0782f24f7
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Thu Mar 7 16:25:14 2019 +0100

    jewel-stringvalidator: solves a regression when maxlength is not defined. Also add the keyup handler only on Android devices, since the rest does not need it
---
 .../royale/jewel/beads/validators/StringValidator.as    | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/StringValidator.as b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/StringValidator.as
index d36fe0e..ff08e77 100644
--- a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/StringValidator.as
+++ b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/validators/StringValidator.as
@@ -21,6 +21,8 @@ package org.apache.royale.jewel.beads.validators
 	COMPILE::JS
 	{
 		import goog.events.BrowserEvent;
+
+		import org.apache.royale.utils.OSUtils;
 	}
 	import org.apache.royale.core.IBead;
 	import org.apache.royale.core.IStrand;
@@ -160,12 +162,21 @@ package org.apache.royale.jewel.beads.validators
                 if(_maxLength > 0)
 				{
 					hostComponent.element.setAttribute('maxlength', _maxLength);
-					//solves Android issue where you can enter more characters than maxlenght in the input
-					hostComponent.element.addEventListener("keyup", forceMaxLength, false);
 				} else
 				{
 					hostComponent.element.removeAttribute('maxlength');
-					hostComponent.element.addEventListener("keyup", forceMaxLength, false);
+				}
+
+				if(OSUtils.getOS() != OSUtils.ANDROID_OS)
+				{
+					if(_maxLength > 0)
+					{
+						//solves Android issue where you can enter more characters than maxlenght in the input
+						hostComponent.element.addEventListener("keyup", forceMaxLength, false);
+					} else
+					{
+						hostComponent.element.removeEventListener("keyup", forceMaxLength, false);
+					}
 				}
             }
 		}