[flexcoders] Re: Weird Validate Binding problem
This may or may not help. It is a combination of the examples in the help for DateValidator and Binding: ?xml version=1.0 encoding=utf-8? !-- Simple example to demonstrate the DateValidator. -- mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; mx:Script import mx.controls.Alert; /mx:Script mx:DateValidator source={dob} property=text allowedFormatChars=/ trigger={myButton} triggerEvent=click valid=Alert.show('Validation Succeeded!'); invalid=Alert.show('Thats not a date!!'); required=true/ mx:Binding source=Date.parse(dob.text).toString() destination=myText.text/ mx:Panel title=DateValidator Example width=75% height=75% paddingTop=10 paddingLeft=10 paddingRight=10 paddingBottom=10 mx:Form mx:FormItem label=Enter date of birth (mm/dd/): mx:TextInput id=dob width=100%/ /mx:FormItem mx:FormItem mx:Button id=myButton label=Validate / /mx:FormItem /mx:Form mx:Text id=myText/ /mx:Panel /mx:Application --- In flexcoders@yahoogroups.com, hardaur55 [EMAIL PROTECTED] wrote: Hello all! I have a TextInput field that is to accept a date. There is a date validator attached to the field and the text property of the date field is bound to a property in another field. Here's the code: mxml: mx:DateValidator id=validateBirthdayTI source={birthdayTI} property=text required=true/ mx:Binding source={Date.parse(birthdayTI.text)} destination=tideContext.user.birthday/ Actionscript: formIsValid = formIsValid validate(validateBirthdayTI); When the validator runs, I get the following error when doing a try/catch, otherwise it fails silently. The source attribute must be specified when the property attribute is specified. This seems to say that the source attribute for the validator isn't correct, but I don't see anything wrong with it (and other fields/properties are fine). It also seems to somehow be tied in to the binding as if I comment out the binding it works (and validates) just fine. I have a feeling I'm running up against one of those very strange Flex errors that don't mean what they say exactly ; ) Any help is very much appreciated, I've been beating on this thing off and on for a week and am getting pretty frustrated. Thanks! G
[flexcoders] Re: Weird Validate Binding problem
I may be wrong but I didn't think you could use a binding with a function. Try removing the Date.parse function from your binding tag... mx:Binding source={birthdayTI.text} destination=tideContext.user.birthday/ --- In flexcoders@yahoogroups.com, hardaur55 [EMAIL PROTECTED] wrote: Hello all! I have a TextInput field that is to accept a date. There is a date validator attached to the field and the text property of the date field is bound to a property in another field. Here's the code: mxml: mx:DateValidator id=validateBirthdayTI source={birthdayTI} property=text required=true/ mx:Binding source={Date.parse(birthdayTI.text)} destination=tideContext.user.birthday/ Actionscript: formIsValid = formIsValid validate(validateBirthdayTI); When the validator runs, I get the following error when doing a try/catch, otherwise it fails silently. The source attribute must be specified when the property attribute is specified. This seems to say that the source attribute for the validator isn't correct, but I don't see anything wrong with it (and other fields/properties are fine). It also seems to somehow be tied in to the binding as if I comment out the binding it works (and validates) just fine. I have a feeling I'm running up against one of those very strange Flex errors that don't mean what they say exactly ; ) Any help is very much appreciated, I've been beating on this thing off and on for a week and am getting pretty frustrated. Thanks! G
[flexcoders] Re: Weird Validate Binding problem
That was how it was originally (same error). Thought I might be having a type issue so added the Date.parse(). You can actually do it if it's specified in the braces ({}). From http://www.adobe.com/devnet/flex/quickstart/using_data_binding/ : Note: The source property of an mx:Binding tag can contain curly braces. When there are no curly braces in the source property, the value is treated as a single ActionScript expression. When there are curly braces in the source property, the value is treated as a concatenated ActionScript expression. Any other ideas? G --- In flexcoders@yahoogroups.com, valdhor [EMAIL PROTECTED] wrote: I may be wrong but I didn't think you could use a binding with a function. Try removing the Date.parse function from your binding tag... mx:Binding source={birthdayTI.text} destination=tideContext.user.birthday/ --- In flexcoders@yahoogroups.com, hardaur55 gander@ wrote: Hello all! I have a TextInput field that is to accept a date. There is a date validator attached to the field and the text property of the date field is bound to a property in another field. Here's the code: mxml: mx:DateValidator id=validateBirthdayTI source={birthdayTI} property=text required=true/ mx:Binding source={Date.parse(birthdayTI.text)} destination=tideContext.user.birthday/ Actionscript: formIsValid = formIsValid validate(validateBirthdayTI); When the validator runs, I get the following error when doing a try/catch, otherwise it fails silently. The source attribute must be specified when the property attribute is specified. This seems to say that the source attribute for the validator isn't correct, but I don't see anything wrong with it (and other fields/properties are fine). It also seems to somehow be tied in to the binding as if I comment out the binding it works (and validates) just fine. I have a feeling I'm running up against one of those very strange Flex errors that don't mean what they say exactly ; ) Any help is very much appreciated, I've been beating on this thing off and on for a week and am getting pretty frustrated. Thanks! G