2 Replies Latest reply on May 15, 2010 3:24 AM by BhaskerChari

    Form Submit Issues


      Okay,  I am new to Flex (first project) and I can't seem to find anything on this that works.


      Basically, what I am trying to do is have the end-user enter data into a single field (SearchBox)  and click a button (SearchButton).  Once the button is clicked add whatever they typed to the QueryString (search.html?id={SearchBox.text}). Should be pretty basic, but everything I try doesn't seem to work. I have taken everything down to the bare bones and this is what I currently have:



      <?xml version = "1.0" encoding = "utf-8"?>
      <mx:Application xmlns:mx = "http://www.adobe.com/2006/mxml" backgroundColor = "0xe4e5e6" layout = "absolute" creationComplete="initVars()">
           <mx:Style source = "chiroptera-main.css" />
                     import com.abdulqabiz.utils.QueryString;
                     // Declare bindable properties in Application scope.
                     public var clientID:String;
                     private var qs:QueryString;
                     // Assign values to new properties.
                     private function initVars():void
                          qs = new QueryString();
                          clientid.text = qs.parameters.id;
      <mx:Canvas width="100%">
                     <mx:FormItem label = "Client Id:">
                          <mx:TextInput id = "SearchBox" styleName = "SearchBox" />
                     <mx:Button id = "SearchButton" styleName = "SearchButton" useHandCursor = "true" buttonMode = "true" />
                <mx:Label id = "clientid" fontWeight = "bold" styleName = "CustomerID" />



      Any help/pointers would be greatly appreciated.


      Thanks in advance.



        • 1. Re: Form Submit Issues
          jfillman Level 1

          Try something like this:









          private var myVar:String = 'searth.html?id='



          private function btnClick():void {

          myVar = myVar+myTI.text;


          trace (myVar);





          1 person found this helpful
          • 2. Re: Form Submit Issues
            BhaskerChari Level 4



            You can only use the QueryString.as class if you want to access the query parameters present in the url. It is not meant for adding the query parameters but to retrieve the query parameters from the url.


            If you want to add the query parameters when the user clicks the search button and want to navigate him to a search page then do the following...

            private var searchURL:String = 'search.html?id='
               public function onButtonClick():void
                searchURL += SearchBox.text;
                navigateToURL(new URLRequest(searchURL));


            Call the above function on click event of SearchButton.


            Hope this will help you..


            Please mark it as answered if it helped you..?



            Bhasker Chari.S

            1 person found this helpful