----- Original Message ----- From: "Paul Andrews" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Friday, October 17, 2008 3:19 AM Subject: Re: [flexcoders] Re: My Flex Form - please help
>A quick look. > > You have in sendMyData:: > > obj.Name = Name.text; > obj.Email = Email.text; > obj.Message = Message.text; > > Yet FormComp has: > > <mx:FormItem label="Name:"> > <mx:TextInput/> > </mx:FormItem> > <mx:FormItem label="Email:"> > <mx:TextInput/> > </mx:FormItem> > <mx:FormItem label="Message:"> > <mx:TextArea/> > </mx:FormItem> > > None of the form fields has an id.. > > Also, > > <mx:Button label="Contact Us" fontSize="16" click="sendMyData()"/> > > shows a click handler function "sendMyData()", yet there's no function > called that in FormComp. sendMydata() is part of the parent application. > You > can probably get away with referring to > Application.application.sendMyData, > but that's really bad practice. > > The coupling of these components is really not as it should be try and > build > components that can be used standalone without having to refer directly to > what is happeining outside. The formComp shouldn't be accessing a handler > in > the parent application. > > The form should dispatch a custom event saying that the form has been > filled > in and that event should include a payload of the form content. The > application should listen for that event and despatch a message using the > event payload. > > I would suggest recapping some of your classes. > > Paul > > > > > > ----- Original Message ----- > From: "brucewhealton" <[EMAIL PROTECTED]> > To: <[email protected]> > Sent: Friday, October 17, 2008 1:34 AM > Subject: [flexcoders] Re: My Flex Form - please help > > >> Hi, >> I have to ask something else... when you said change the >> reference to Name, I wasn't sure that you meant on the left of the = >> or right. >> I have taken a class on AS 3.0 and two on Flex 3 and it was very >> extensive... getting into OOP. I thought I had things figured out. >> Could you or someone please look at my code and specifically edit it >> to work. It is very small and I only need to have one field in the >> form for demonstration purposes. It might be only a line or two that >> needs to be changed or added. There are only two files so far. >> Here's the link: >> http://fwweb.biz/ContactForm.zip >> Please email me directly or post the fixed code specifically as >> it would need to be for this to work. >> I'll reproduce the code below as well. It's not long. As a >> note, I did find a free Flex/PHP application that does this. However, >> I want to figure out how to get the very basic application that I >> started, working right, instead of just taking something else. I want >> to figure out the exact logic that would work to accomplish what I am >> trying. By being real basic, I can focus mainly on the details and >> concepts that I am getting wrong. >> The instructor in the two classes I took on Flex Builder 3, >> stated that I needed an HTTPService tag which calls the php form >> processing script that emails form results to a specified email >> address - setting the method to POST. In the form component, I would >> call an AS 3.0 function that creates the object, obj:Object = new >> Object(); -> then in the function sendMyData, I call the HTTPService >> send method. >> >> It sounds like you are saying that I shouldn't use obj but >> should use something like this: >> <forms:FormComp id="form"/> >> Then, in the function sendMyData(, I just do it like this: >> form.Name = Name.text; >> No, that doesn't work. It still gives me an error saying: >> Access to undefined property Name. >> I really didn't follow that either. I thought I would need an >> object that would have properties sent to the HTTPService request >> which calls the php form processor which will email me the results. >> >> Please, check out the code I include and if you or someone else would, >> please replace what I did wrong with the right code. That way I can >> see exactly how to make this work. I just got a little confused when >> you were saying that I need to use form.Name as I didn't know if you >> meant just replace that in the function that I have and that we are >> talking about this on the left or right of the equals sign and if not, >> then what are we setting equal to form.Name. >> >> Lastly, I have two large books for learning AS 3.0 and OOP, >> ActionScript 3.0 Bible and Flex 3.0 Bible. They are rather extensive >> and long and AS 3.0 Bible does get into OOP. If you would recommend a >> different or additional text, please let me know. I'll definitely >> start reading the information at the link you sent to me - to the >> livedocs article. >> thanks, >> Bruce >> >> >> --- In [email protected], "Haykel BEN JEMIA" <[EMAIL PROTECTED]> >> wrote: >>> >>> The problems you are having are related to very basic actionscript and >>> object oriented programming knowledge. Don't get me wrong, I'm in no way >>> blaming you, I just want to give you the advice to read some >> documentation >>> about AS and OO programming because otherwise you will be loosing >> much time >>> with basic things! >>> You can start with "Programming ActionScript 3.0" from the Flex >>> documentation: >>> >> http://livedocs.adobe.com/flex/3/html/help.html?content=Part6_ProgAS_1.html >>> >>> Now to the problem. You are getting this error because the "Name" >> field is >>> not defined where you are calling it, but in the FormComponent. If you >>> instantiate the FormComponent with an id of "form" for example, you can >>> access it with: form.Name. Note that it has to be declared public in the >>> component to be able access it from outside the component. >>> >>> Hope it helps! >>> >>> >>> On Thu, Oct 16, 2008 at 9:10 AM, brucewhealton >>> <[EMAIL PROTECTED]>wrote: >>> >>> > Hi, thanks for the help. I did what you mention below. Someone else >>> > posted somethingsimilar about putting the Object property into the >>> > function. >>> > >>> > It still doesn't like that yet. It gives me an error on the line in >>> > the function where I am assigning values to the Object properties... >>> > Specifically it doesn't like: >>> > obj.Name = Name.text; >>> > it says: Access to undefined property Name >>> > >>> > Now, one problem might be that I am not passing any parameters to the >>> > function. >>> > I'll see about the way you specified the function and see if that >>> > fixes things. >>> > >>> > To see more specifically what I did, please click on this to download >>> > the zip archive file of my Flex Project: >>> > >>> > http://fwweb.biz/ContactForm.zip >>> > >>> > thanks, >>> > Bruce >>> > >> >> >> >> ------------------------------------ >> >> -- >> Flexcoders Mailing List >> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt >> Alternative FAQ location: >> https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 >> Search Archives: >> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups >> Links >> >> >> >> > > > ------------------------------------ > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Alternative FAQ location: > https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847 > Search Archives: > http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups > Links > > > >

