5 Replies Latest reply on May 29, 2009 1:44 AM by *Prashant Shelke*

    Populating popup data to the textarea in the application

    sweetysk

      Hello,

       

              Can anyone please tell me how can we populate popup data back to the text area in the application. what are the required things to do.

      Thanks in advance.

        • 1. Re: Populating popup data to the textarea in the application
          *Prashant Shelke* Level 4

          I think you have to maintain instance of parent in the PopUp, see:


          Parent.mxml

                  var titleWindowInstance:PopUp= PopUp(PopUpManager.createPopUp(this, PopUp, true));

                  titleWindowInstance.parent = this;

                   PopUpManager.centerPopUp( titleWindowInstance );


          PopUp.mxml

                 var parent:Parent;

                

          before close of pop-up window you can do: parent.textArea.text = "This is new string...";


          Thanks.

          • 2. Re: Populating popup data to the textarea in the application
            sweetysk Level 1

            Thanks for your help.

             

                      I have developed employee details application.In that while registering employee I have given address field. address field is the text area and beside that text area I am giving one image to get popup. In that popup I am giving some fields like street, city, country and zipcode. In that I have Ok button and Cancel button. When I click on Ok button I must get popup data back to the textarea which means whatever I have entered in the popup text fields not the static data and when I click on Cancel button popup should be closed.

             

            Can anyone please help me doing this..

            Thanks in Advance.

            • 3. Re: Populating popup data to the textarea in the application
              *Prashant Shelke* Level 4

              Please find attachment & run EmpInfo.mxml


              Actually what you want I have already addressed in previous comment!


              Thanks.

              • 4. Re: Populating popup data to the textarea in the application
                *Prashant Shelke* Level 4

                There was some problem in uploading files... attaching again.

                • 5. Re: Populating popup data to the textarea in the application
                  *Prashant Shelke* Level 4

                  Not succedding upload..


                  Please copy & paste code in your files & then try..


                  EmpInfo.mxml


                  <?xml version="1.0" encoding="utf-8"?>
                  <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
                      <mx:Script>
                          <![CDATA[
                              import mx.managers.PopUpManager;
                              public function popUp():void
                              {
                                  var titleWindow:PopUp = PopUp(PopUpManager.createPopUp(this, PopUp, true));
                                  titleWindow.empInfo = this;
                                  PopUpManager.centerPopUp(titleWindow);
                              }
                          ]]>
                      </mx:Script>
                      <mx:TextArea id="txtArea"  x="166" y="176"/>
                      <mx:Image source="go.jpg" click="popUp();" x="353" y="185"/>
                  </mx:Application>


                  PopUp.mxml

                  <?xml version="1.0" encoding="utf-8"?>
                  <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="400" height="300" close="PopUpManager.removePopUp(this);">
                      <mx:Script>
                          <![CDATA[
                              import mx.managers.PopUpManager;
                              public var empInfo:EmpInfo;
                              public function setDataToParent():void
                              {
                                  empInfo.txtArea.text = ("" + txtInpName.text + " " + txtInpAdd.text + " " + txtInpPh.text);
                                 
                                  PopUpManager.removePopUp(this);
                              }
                          ]]>
                      </mx:Script>
                      <mx:VBox width="380">
                          <mx:HBox>
                              <mx:Label text="Emp Name" />
                              <mx:TextInput width="200" id="txtInpName" />   
                          </mx:HBox>
                          <mx:HBox>
                              <mx:Label text="Emp Address"/>
                              <mx:TextInput width="200" id="txtInpAdd" />   
                          </mx:HBox>
                          <mx:HBox>
                              <mx:Label text="Emp Phone"/>
                              <mx:TextInput width="200" id="txtInpPh" />   
                          </mx:HBox>
                          <mx:Button click="setDataToParent();" label="Save"/>
                      </mx:VBox>
                  </mx:TitleWindow>

                   

                  Thanks.