[jira] [Updated] (FLEX-16714) Validator. Credit Card Validator does not work properly when property 'required' is false
[ https://issues.apache.org/jira/browse/FLEX-16714?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Justin Mclean updated FLEX-16714: - Labels: easyfix easytext (was: easyfix) Validator. Credit Card Validator does not work properly when property 'required' is false - Key: FLEX-16714 URL: https://issues.apache.org/jira/browse/FLEX-16714 Project: Apache Flex Issue Type: Bug Components: Validators Affects Versions: Adobe Flex SDK 3.1 (Release) Environment: Affected OS(s): Windows Browser: Internet Explorer 6.x Language Found: English Reporter: Adobe JIRA Labels: easyfix, easytext Steps to reproduce: 1. Application code: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; mx:Form mx:FormItem label=Account Number mx:TextInput id=ti width=200/ /mx:FormItem mx:FormItem mx:Button id=btn label=Submit click=submit(event)/ /mx:FormItem /mx:Form mx:CreditCardValidator id=ccV required=false cardNumberSource={ti} cardNumberProperty=text cardTypeSource={cardType} cardTypeProperty=type allowedFormatChars= invalid=_valid = false; valid=_valid = true;/ mx:Script ![CDATA[ import mx.controls.Alert; [Bindable] private var cardType:Object = {type:American Express}; private var _valid:Boolean; private function submit(event:MouseEvent):void { ccV.validate(); Alert.show(_valid.toString()); } ]] /mx:Script /mx:Application 2. Set ccv property 'required' to false. This means that validator should consider empty input as valid. 3. Launch application 4. Do not enter any input. Click on Submit button. 5. See the value on the Alert box. Actual Results: 1. Alert box shows 'false'. The validator.as code in my sdk has a function per below: public function validate( value:Object = null, suppressEvents:Boolean = false):ValidationResultEvent { if (value == null) value = getValueFromSource(); // if required flag is true and there is no value // we need to generate a required field error if (isRealValue(value) || required)*** THIS SHOULD BE 'AND' INSTEAD OF 'OR' * { return processValidation(value, suppressEvents); } else { // Just return valid return new ValidationResultEvent(ValidationResultEvent.VALID); } } Because of the existing OR condition, the logic flows to processValidation even though required is false. Expected Results: 1. Alert box should show 'true'. Since the ccV property 'required' is set to false, I expect the validator to not validate 'empty' textinput. Workaround (if any): -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (FLEX-16714) Validator. Credit Card Validator does not work properly when property 'required' is false
[ https://issues.apache.org/jira/browse/FLEX-16714?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Mark Kessler updated FLEX-16714: Labels: easyfix (was: ) Validator. Credit Card Validator does not work properly when property 'required' is false - Key: FLEX-16714 URL: https://issues.apache.org/jira/browse/FLEX-16714 Project: Apache Flex Issue Type: Bug Components: Validators Affects Versions: Adobe Flex SDK 3.1 (Release) Environment: Affected OS(s): Windows Browser: Internet Explorer 6.x Language Found: English Reporter: Adobe JIRA Labels: easyfix Steps to reproduce: 1. Application code: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; mx:Form mx:FormItem label=Account Number mx:TextInput id=ti width=200/ /mx:FormItem mx:FormItem mx:Button id=btn label=Submit click=submit(event)/ /mx:FormItem /mx:Form mx:CreditCardValidator id=ccV required=false cardNumberSource={ti} cardNumberProperty=text cardTypeSource={cardType} cardTypeProperty=type allowedFormatChars= invalid=_valid = false; valid=_valid = true;/ mx:Script ![CDATA[ import mx.controls.Alert; [Bindable] private var cardType:Object = {type:American Express}; private var _valid:Boolean; private function submit(event:MouseEvent):void { ccV.validate(); Alert.show(_valid.toString()); } ]] /mx:Script /mx:Application 2. Set ccv property 'required' to false. This means that validator should consider empty input as valid. 3. Launch application 4. Do not enter any input. Click on Submit button. 5. See the value on the Alert box. Actual Results: 1. Alert box shows 'false'. The validator.as code in my sdk has a function per below: public function validate( value:Object = null, suppressEvents:Boolean = false):ValidationResultEvent { if (value == null) value = getValueFromSource(); // if required flag is true and there is no value // we need to generate a required field error if (isRealValue(value) || required)*** THIS SHOULD BE 'AND' INSTEAD OF 'OR' * { return processValidation(value, suppressEvents); } else { // Just return valid return new ValidationResultEvent(ValidationResultEvent.VALID); } } Because of the existing OR condition, the logic flows to processValidation even though required is false. Expected Results: 1. Alert box should show 'true'. Since the ccV property 'required' is set to false, I expect the validator to not validate 'empty' textinput. Workaround (if any): -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira