I've been playing around with validators and seem to have
encountered a behavior which is unexpected. Here's a sample of what I'm
doing:
-------------------
[snip...]
<mx:Model
id="paymentInformationModel">
<usepurchaseorder>{ usePurchaseOrder.selected }</usepurchaseorder> <purchaseordernumber>{ purchaseOrderNumber.text }</purchaseordernumber> </mx:Model> <mx:StringValidator
field="paymentInformationModel.purchaseordernumber"
required="{usePurchaseOrder.selected}" />
<mx:Form
width="100%">
<mx:FormHeading label="Purchase Order" /> <mx:FormItem label="Pay using
purchase order"
required="false">
<mx:CheckBox id="usePurchaseOrder" label=""/> </mx:FormItem> <mx:FormItem label="Purchase Order Number" required="{usePurchaseOrder.selected}"
enabled="{usePurchaseOrder.selected}">
<mx:TextInput id="purchaseOrderNumber" width="100" maxChars="50" /> </mx:FormItem> </mx:Form> [...snip]
----------------------
(This
is modified from the Cairngorm store and uses the Validator.isStructureValid
call in the same way.)
This
displays correctly -- the user clicks the checkbox to use a purchase order and
the field becomes enabled and displays an asterisk beside it. But if the
user leaves it unchecked, then upon submitting the form it still thinks the
field is required. The telling part is that if I change the
StringValidator to have required="false" instead of
required="{usePurchaseOrder.selected}" then it correctly sees it as not
required.
What
am I missing here?
Thanks,
Blake
-- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
YAHOO! GROUPS LINKS
|
- [flexcoders] StringValidator and required fields Blake Kadatz
- RE: [flexcoders] StringValidator and required field... Alistair McLeod
- RE: [flexcoders] StringValidator and required field... Blake Kadatz
- RE: [flexcoders] StringValidator and required field... Blake Kadatz
- RE: [flexcoders] StringValidator and required field... Battershall, Jeff
- RE: [flexcoders] StringValidator and required field... Blake Kadatz