7 Replies Latest reply on Dec 7, 2006 11:48 AM by NiiOdoiThompson

    Creating Forms

    NiiOdoiThompson
      I've searched the web on how to create a form (html form) in flex to no avail.. I will be very glad if someone can provide me with the source code and instructions to create a form in Flex. Thanks in advance! I look forward to hearing from you.
        • 1. Re: Creating Forms
          ntsiii Level 3
          What exactly do you mean? Flex is not HTML.

          And this is the wrong forum for this question. It should go in General Discussion.

          Tracy
          • 2. Re: Creating Forms
            NiiOdoiThompson Level 1
            Sorry for posting it in the wrong forum. My question was, how do I create a form in flex..any help will be appreciated.
            • 3. Re: Creating Forms
              ntsiii Level 3
              We need more detail. Your question, "how do I create a form in flex?" is too general.

              What do you mean when you use the word "form"? What do you want to achieve?

              Tracy
              • 4. Re: Creating Forms
                NiiOdoiThompson Level 1
                Sorry Tracy..I want to build an email form in flex..How do I go about it..Thanks
                • 5. Re: Creating Forms
                  ur_dtrain Level 1
                  You would use somthing like this:

                  <mx:Form id="emailForm" styleName="emailForm" horizontalCenter="0" top="80">
                  <mx:FormItem label="To" required="true">
                  <mx:TextInput id="emailTo" width="220"/>
                  </mx:FormItem>
                  <mx:FormItem label="From" required="true">
                  <mx:TextInput id="emailFrom" width="220"/>
                  </mx:FormItem>
                  <mx:FormItem label="Message">
                  <mx:TextArea id="message" width="220" height="100"/>
                  </mx:FormItem>
                  <mx:FormItem>
                  <mx:HBox paddingLeft="15">
                  <mx:Button id="cancelBtn" styleName="formButton" label="Cancel" click="closeForm(event);"/>
                  <mx:Button id="emailBtn" styleName="formButton" label="Send Now" click="checkEmail();"/>
                  </mx:HBox>
                  </mx:FormItem>
                  </mx:Form>

                  You'll have to write your own functions, of course and pass the data from each field to an external service that can handle sending mail. ( I use <cfmail> in a RemoteObject function call to a CFC on the server)
                  • 6. Re: Creating Forms
                    karina_a
                    have u searched in flex help, cuz i found the "Creating forms" topic on it... and here is an example:
                    <?xml version="1.0"?>
                    <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">

                    <mx:Script>
                    <![CDATA[
                    // Dummy function that does nothing for this example.
                    private function setValues(fnName:String, lname:String,
                    addr1:String, addr2:String, city:String, st:Object,
                    zip:String, cntry:Object):void {}
                    ]]>
                    </mx:Script>

                    <mx:Form id="myForm" width="400">

                    <mx:FormHeading label="Billing Information"/>

                    <mx:FormItem label="First Name">
                    <mx:TextInput id="fname" width="100%"/>
                    </mx:FormItem>

                    <mx:FormItem label="Last Name">
                    <mx:TextInput id="lname" width="100%"/>
                    </mx:FormItem>

                    <mx:FormItem label="Address">
                    <mx:TextInput id="addr1" width="100%"/>
                    <mx:TextInput id="addr2" width="100%"/>
                    </mx:FormItem>

                    <mx:FormItem label="City / State" direction="vertical">
                    <mx:TextInput id="city"/>
                    <mx:ComboBox id="st" width="50"/>
                    </mx:FormItem>

                    <mx:FormItem label="Zip Code">
                    <mx:TextInput id="zip" width="100"/>
                    </mx:FormItem>

                    <mx:FormItem label="Country">
                    <mx:ComboBox id="cntry"/>
                    </mx:FormItem>

                    <mx:FormItem>
                    <mx:Button label="Submit"
                    click="setValues(fname.text, lname.text, addr1.text, addr2.text,
                    city.text, st.value, zip.text, cntry.value);"/>
                    </mx:FormItem>

                    </mx:Form>
                    </mx:Application>

                    • 7. Re: Creating Forms
                      NiiOdoiThompson Level 1
                      Thanks for the help guys. Based on your examples how do I submit the form data to my php file so that it sends the form information to my email address. Thanks