1 Reply Latest reply on May 9, 2007 9:18 PM by HyderAlamgir

    Finding simple form so dificult

    donkeychoker
      Hi all. Been struggling with a form for hours now. I just don't seem to be able to understand how it works, or doesn't!
      I cannot find anything on the net on how to create a form without the tutorials using datagrids.
      I thought datagrids were for displaying data which I don't want. Just want to send data to a php page.

      My problem is the submit button will not work. Any help greatfully accepted. My code below
      quote:


      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" creationComplete="send_data()">
      <mx:Script>
      <![CDATA[
      private function send_data():void {
      userRequest.send();
      }
      ]]>
      </mx:Script>

      <mx:Array id="towns">
      <mx:Object label="Axminster" data="axminster" />
      <mx:Object label="Beaminster" data="beaminster" />
      <mx:Object label="Bridport" data="bridport" />
      </mx:Array>
      <mx:Array id="trades">
      <mx:Object label="Aerial Installers" data="Aerial Installers" />
      <mx:Object label="Designers" data="Designers" />
      <mx:Object label="Hairdressers" data="Hairdressers" />
      </mx:Array>
      <mx:StringValidator
      id="nameValidator"
      source="{company_name}"
      property="text"
      minLength="3"
      />


      <mx:Canvas width="100%" height="100%">
      <mx:Form width="100%" height="100%" backgroundColor="#ffffff">
      <mx:Label text="Which area or town is closest to you?" fontWeight="bold"> </mx:Label>
      <mx:ComboBox id="town" dataProvider="{towns}">
      </mx:ComboBox>

      <mx:Label text ="What is your main trade ?" fontWeight="bold"/>
      <mx:ComboBox id="trade" dataProvider="{trades}"> </mx:ComboBox>
      <mx:Label text="Company name?" fontWeight="bold"/>
      <mx:TextInput width="278" height="25" id="company_name" borderStyle="inset" backgroundColor="#ffff80"/>

      <mx:Label text="Heading you want displayed on the page ?" fontWeight="bold"/>
      <mx:TextInput x="279" y="112" width="429" backgroundColor="#ffff80" id="heading"/>
      <mx:Label text="Description" fontWeight="bold"/>
      <mx:RichTextEditor x="168" y="160" width="528" height="248" id="main_text">
      </mx:RichTextEditor>
      <mx:Label text="Address" fontWeight="bold"/>
      <mx:TextArea x="168" y="436" width="359" height="53" id="address"/>
      <mx:Label text="Postcode" fontWeight="bold"/>
      <mx:TextInput x="168" y="514" id="postcode"/>
      <mx:Label text="Website Address" fontWeight="bold"/>
      <mx:TextInput x="168" y="555" width="248"/>

      <mx:Button label="Submit" click="send_data()"/>
      </mx:Form>


      </mx:Canvas>
      <mx:HTTPService id="userRequest" url="flex.php" useProxy="false" method="POST">
      <mx:request xmlns="">
      <town>{town.text}</town><trade>{trade.text}</trade>
      </mx:request>
      </mx:HTTPService>
      </mx:Application>
        • 1. Re: Finding simple form so dificult
          HyderAlamgir Level 1
          First off, correct this.... {trades} => {trade}

          <mx:ComboBox id="trade" dataProvider="{trades}"> </mx:ComboBox>

          Then, post the PHP file. It might help


          Also keep in mind that you need a PHP server like Appache to parse the PHP file. If you don't know about it, let us know. I'm new to all of this as well. Learned it the hard way, hope I can help you.