3 Replies Latest reply on Nov 29, 2010 10:52 PM by ravi burila

    unable to set default button...........

    ravi burila

      Hi,

      iam having an array collection which contains a set of textinput and button objects. Iam using repeater to diaplay them.

      so may i know how can i use defaultbutton in this context

      code :

       

      <mx:Repeater

       

       

      id="myRep" dataProvider="{column2}" >                                       //if i set default button={submit}.  iam getting an error object cabbot be replaced by object

       

       

      <mx:HBox verticalAlign="middle">

       

       

      <mx:Label text="{myRep.currentItem}" id="processName" width="260"/>

       

       

      <mx:TextInput id="startTime" width="100"/>

       

       

      <mx:TextInput id="endTime" width="100" />

       

       

      <mx:TextInput id="remarks" width="100" />

       

       

      <mx:TextInput id="recordCount" width="150" />

       

       

      <mx:Button id="submit" label="ADD>>" click="addTrans(event.currentTarget as Button);"/>

       

       

      </mx:HBox>

       

       

       

      </mx:Repeater>

       

       

      thanks in advance........

        • 1. Re: unable to set default button...........
          fleRavix

          Simple,

          First identify the default button. Then use the following the syntax

           

          btnName.setFocus();

           

          Thats it!!

           

          Please Mark this answered if useful.

          • 2. Re: unable to set default button...........
            Tanu Jain Level 2

            Repeater control in itself doesnt have "defaultButton" property as it has many repititive sets of same type of controls, so one button can not be declared as defaultButton.

             

            Do it the following way: Use form to group each set of controls and declare defaultButton for the form.

             

            <mx:Repeater>
                    <mx:Form defaultButton="{submit}">           
                        <mx:label />

                        <mx:Button id="button1" />
                        <mx:Button id="submit" />
                    </mx:Form>
                </mx:Repeater>

             

            Hope this helps!!

             

            ---

            Tanu

            • 3. Re: unable to set default button...........
              ravi burila Level 1

              <mx:Repeater dataprovider="{someArray}">
                      <mx:Form defaultButton="{submit}">           
                          <mx:label />

                          <mx:Button id="button1" />
                          <mx:Button id="submit" />
                      </mx:Form>
                  </mx:Repeater>

               

              It is not accepting an array in place of an object. An error message is displayed.