1 Reply Latest reply on Jul 31, 2009 2:29 PM by cyber0897

    confirmation box and textbox data changes

    cyber0897 Level 1

      hey guys, im having some trouble trying to figure this one out... its a very simple but since i am very new to flex, im having a hard time trying to figure this out.

      basically what my application does is, first it gets the list of websites into a datagrid, on click of one of those websites it populates the list of modules in another datagrid. Once you click on one of those items you get the following component:

       

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo" width="100%" height="100%"
           initialize="init();">
          <s:layout>
              <s:BasicLayout/>
          </s:layout>
          <fx:Script source="mainSiteEditorScript.as" />
                      <mx:VBox width="100%" height="100%">
                          <mx:Accordion width="100%" height="100%">
                              <mx:VBox label="Main Information" width="100%" height="100%">
                                  <mx:Form width="100%">
                                      <mx:FormItem label="Site Name:">
                                          <s:TextInput id="text1" text="{modules.SiteEditor.siteEditor.siteListData.name}" />
                                      </mx:FormItem>
                                      <mx:FormItem label="Site Title:">
                                          <s:TextInput text="{modules.SiteEditor.siteEditor.siteListData.siteTitle}" />
                                      </mx:FormItem>
                                      <mx:FormItem label="Production Address:">
                                          <s:TextInput text="{modules.SiteEditor.siteEditor.siteListData.addressProduction}" />
                                      </mx:FormItem>
                                      <mx:FormItem label="Test Address:">
                                          <s:TextInput text="{modules.SiteEditor.siteEditor.siteListData.addressTest}" />
                                      </mx:FormItem>
                                      <mx:FormItem label="Route Handeler" >
                                          <s:TextInput text="{modules.SiteEditor.siteEditor.siteListData.routeHandlerName}" />
                                      </mx:FormItem>
                                      <mx:FormItem label="Content Owner">
                                          <s:TextInput text="{modules.SiteEditor.siteEditor.siteListData.contentOwner}" />
                                      </mx:FormItem>
                                      <mx:FormItem label="Publish">
                                          <s:TextInput text="{modules.SiteEditor.siteEditor.siteListData.publish}" />
                                      </mx:FormItem>
                                      <mx:FormItem label="Public Access">
                                          <s:TextInput text="{modules.SiteEditor.siteEditor.siteListData.publicAccess}" />
                                      </mx:FormItem>
                                  </mx:Form>
                              </mx:VBox>
                              <mx:VBox label="Look and Feel Information" width="100%" height="100%">
                                  <mx:Form width="100%">
                                      <mx:FormItem label="Site CSS:">
                                         
                                      </mx:FormItem>
                                      <mx:FormItem label="Master Template:">
                                          <s:TextInput text="{modules.SiteEditor.siteEditor.siteListData.masterTemplate}" />
                                      </mx:FormItem>
                                      <mx:FormItem label="Error Page">
                                          <s:TextInput text="{modules.SiteEditor.siteEditor.siteListData.errorPage}" />
                                      </mx:FormItem>
                                      <mx:FormItem label="Home Page">
                                          <s:TextInput text="{modules.SiteEditor.siteEditor.siteListData.homePage}" />
                                      </mx:FormItem>
                                      <mx:FormItem label="Nav Style">
                                         
                                      </mx:FormItem>
                                      <mx:FormItem label="Box W">
                                          <s:TextInput text="{modules.SiteEditor.siteEditor.siteListData.boxW}" />
                                      </mx:FormItem>
                                      <mx:FormItem label="Box H">
                                          <s:TextInput text="{modules.SiteEditor.siteEditor.siteListData.boxH}" />
                                      </mx:FormItem>
                                  </mx:Form>
                              </mx:VBox>
                              <mx:VBox label="Navigation" width="100%" height="100%">
                                 
                              </mx:VBox>
                              <mx:VBox label="SEO" width="100%" height="100%">
             
                              </mx:VBox>
                          </mx:Accordion>
                      </mx:VBox>
      </s:Group>

       

       

      what im trying to figure out is once i change something on the text inputs and click away from the component like when you change the website or teh module, i need a confirmation box to popup trying to see if the user wants to get rid of all the changes that were just made.

       

       

       

      this is the code insode the mainSiteEditorScript.as:

       

       

      // ActionScript file
      import mx.controls.Alert;
      import mx.controls.TextArea;
      import mx.events.CloseEvent;

       

      [Bindable] public var temp:String = modules.SiteEditor.siteEditor.siteTitle;

       


      public function init():void{
          //Alert.show(modules.SiteEditor.siteEditor.siteTitle);
      }

       

      public function confirmChanges():void{
          Alert.show("Confirm update","Warning",Alert.OK|Alert.CANCEL,this,update_CarePlanShift,null,Alert.OK);
      }
      public function update_CarePlanShift(eventObj:CloseEvent):void
      {
         if(eventObj.detail==Alert.OK)
         {
             //code for updating whatever needs to be update
         }

       

         else if(eventObj.detail==Alert.CANCEL)
         {
             //no code required here unless you want to notify the user that they have cancelled the operation
         }
      }

       

       

       

       


      thanks a lot in advace for all the help!!