8 Replies Latest reply on Aug 5, 2011 2:30 AM by GAUSSARD

    TextInput and Combobox inside Repeater : How to get "text property" and "selectedItem" ?

    GAUSSARD

      Hello everybody, I'm serious problem. I'm tryin to use in my Controller the "text property" of a textInput field and the "selectedItem" of a combobox generated by a repeater which is in my View. But it doesn't work. Can somebody help me to fix this problem ?

       

       

      Here's a sample of my View :

      <mx:FormItem label=""> //this numericStepper is my repater "rpArgs" dataProvider
      <mx:NumericStepper id="nsArgs" change="controller.updateNbArgs(event)" width="50" />
      </mx:FormItem>

       

      <mx:Repeater id="rpArgs" dataProvider="{controller.nbargs}">
      <mx:FormItem label="argv" width="100%">
              <mx:TextInput id="nameArgs" text="" width="100%" />
      </mx:FormItem>                        
      </mx:Repeater>

      <mx:FormItem label=""> //this numericStepper is my repeater "rpLicences" dataProvider
      <mx:NumericStepper id="nsLicence" change="controller.updateNbLicence(event)" maximum="{controller.licences.length}" />
      </mx:FormItem>

       

      <mx:Repeater id="rpLicences" dataProvider="{controller.nblicences}">
      <mx:FormItem label="" width="100%">
                      <mx:ComboBox id="comboLicence" dataProvider="{controller.licences}" />
      </mx:FormItem>
      </mx:Repeater>

       

      <mx:HBox width="100%" horizontalAlign="center">
      <mx:Button label="Clear fields" click="controller.clearFields()" />
      <mx:Button label="Ajouter" click="controller.createTpl(event)" />
      </mx:HBox>

      Here's a sample of my Controller:


      public function createTpl(event:Event):void //Pour ajouter un template !!!
      var dataForTpl : Object = new Object();
                              dataForTpl.nameArgs = view.rpArgs.String(event.currentTarget.getRepeaterItem()); //The 1st problem is here
                              dataForTpl.comboLicence = view.comboLicence.dataProvider.getItemAt(view.comboLicence.selectedIndex);  //the 2nd is here !!

      this.model.createTplRequest.request.data = JSON.encode(dataForTpl);
      this.model.createTplRequest.send();