Hi, I sent this response to the labs forums as well.
phil --------- I have an internal build, and your code works as written. I don't have the public alpha version installed at the moment, but it's possible there was a bug in the validator that's preventing your application from working properly. We do plan to release another build in the next 30-60 days (sorry, can't be more specific), so you'll get a version that has this issue resolved. Phil Costa Group Product Manager, Flex -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Ken Bromberger Sent: Sunday, January 08, 2006 1:06 PM To: [email protected] Subject: RE: [flexcoders] Re: Flex 2.0 Form validation Hi Simon, Thanks for the attempt on this, but it still does not trigger the HTTPService. Any other ideas? -Ken -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Simon Barber Sent: Sunday, January 08, 2006 1:34 AM To: [email protected] Subject: [flexcoders] Re: Flex 2.0 Form validation Try this... <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml" xmlns="*"> <mx:Script> <![CDATA[ // Import event class import mx.events.ValidationResultEvent; import mx.validators.Validator; import flash.events.Event; private function handleValid(eventObj:Event):Void { var result:ValidationResultEvent = Validator (strV).validate(); if(result.type==ValidationResultEvent.VALID) sub_btn.enabled = true; else sub_btn.enabled = false; } // Submit form is everything is valid. private function submitForm():Void { test.send(); } ]]> </mx:Script> <mx:StringValidator id="strV" source="{test1}" property="text" minLength="5" /> <mx:HTTPService id="test" url="http://localhost/xml/template/test.xml" method="POST" showBusyCursor="True"> <mx:request xmlns=""> <test1>{test1.text}</test1> <test2>{test2.text}</test2> </mx:request> </mx:HTTPService> <mx:Canvas width="100%" height="100%"> <mx:Form x="34" y="25"> <mx:Label text="{test.result.root.tblTest.success}"/> <mx:FormHeading label="Test Form"/> <mx:FormItem label="Test 1" id="test1_lbl"> <mx:TextInput id="test1" change="handleValid (event)"/> </mx:FormItem> <mx:FormItem label="Test 2" id="test2_lbl"> <mx:TextInput id="test2"/> </mx:FormItem> <mx:Button label="Submit" id="sub_btn" click="submitForm();" enabled="false"/> </mx:Form> </mx:Canvas> </mx:Application> What i have done here is when the change event is fired on the text1 TextInput the handleValid function is called. This checks to see if the string is valid. Let me know if this works, Simon Barber --- In [email protected], "Ken Bromberger" <[EMAIL PROTECTED]> wrote: > > Hi! I am new to flex and I am working on using the validators flex 2.0 > includes. > > > > I have set up a form and can submit data to my test database using > HTTPService and the request tags and return a result. When I add a > string validator to my code the form no longer submits the HTTPService > request. If I remove the stringValidator from my code the form works > just fine. What am I missing on this?? Is there a good resource with > examples of how to implement validation? > > Thanks! - Ken > > > > Here is my code: > > > > <?xml version="1.0" encoding="utf-8"?> > > <mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml" > xmlns="*"> > > > > <mx:Script> > > <![CDATA[ > > > > // Import event class > > import mx.events.ValidationResultEvent; > > > > private function > handleValid(eventObj:ValidationResultEvent):Void { > > if(eventObj.type==ValidationResultEvent.VALID) > > sub_btn.enabled = true; > > else > > sub_btn.enabled = false; > > } > > > > // Submit form is everything is valid. > > private function submitForm():Void { > > test.send(); > > } > > > > ]]> > > </mx:Script> > > > > <mx:StringValidator id="strV" source="{test1}" property="text" > minLength="5" valid="handleValid(event)" invalid="handleValid (event)"/> > > > > <mx:HTTPService id="test" > url="http://localhost/xml/template/test.xml" method="POST" > showBusyCursor="True"> > > <mx:request xmlns=""> > > <test1>{test1.text}</test1> > > <test2>{test2.text}</test2> > > </mx:request> > > </mx:HTTPService> > > > > <mx:Canvas width="100%" height="100%"> > > <mx:Form x="34" y="25"> > > <mx:Label > text="{test.result.root.tblTest.success}"/> > > <mx:FormHeading label="Test Form"/> > > <mx:FormItem label="Test 1" id="test1_lbl"> > > <mx:TextInput id="test1" change="handleValid(event)"/> > > </mx:FormItem> > > <mx:FormItem label="Test 2" id="test2_lbl"> > > <mx:TextInput id="test2"/> > > </mx:FormItem> > > > > <mx:Button label="Submit" id="sub_btn" > click="submitForm();" enabled="false"/> > > > > </mx:Form> > > </mx:Canvas> > > > > </mx:Application> > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

