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/yyyy): ">
                 <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
>

Reply via email to