3 Replies Latest reply on Apr 28, 2011 9:43 PM by Muthu Prasad

    Checkbox in front of formitem label

    Muthu Prasad Level 1

      Hi,

          I use flex 3 to design a form, i want a check box before every label, i tried without setting label property in formitem but the component alignment is not good as below

       

       

       

      is there a way to add check box before the label or is there anyother layout  that will suit for this requirement. Please provide me a sample code if possible

       

      thanks

      prasad

        • 1. Re: Checkbox in front of formitem label
          UbuntuPenguin Level 4

          So do you want a ream of checkboxes or do you want a form ?


          • 2. Re: Checkbox in front of formitem label
            Shravan P Level 1

            Prasad,

             

            Add label property to the checkbox.

             

            checkout this below example:

             

            <?xml version="1.0"?>
            <!-- containers\layouts\FormReqFieldRuntime.mxml -->
            <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

             

                <mx:Form>
                    <mx:FormItem label="Subscribe">
                        <mx:CheckBox label="Subscribe?"
                            click="emAddr.required=!emAddr.required;"/>
                    </mx:FormItem>

             

                    <mx:FormItem id="emAddr" label="E-mail Address">
                        <mx:TextInput id="emailAddr"/>
                    </mx:FormItem>
                </mx:Form>
            </mx:Application>

             

            For More info: http://livedocs.adobe.com/flex/3/html/help.html?content=layouts_08.html

            -Shravan P.

            • 3. Re: Checkbox in front of formitem label
              Muthu Prasad Level 1

              I do not need ream of check box, I need a the checkbox before formitem label and the label followed by the component.I need this to enable and disable the component followed after label. I need many formitems like this. I tried as below but the alignment of the components under form is not good.

               

                      <mx:FormItem direction="horizontal" >
                          <mx:CheckBox change="{countryresidence.enabled=!countryresidence.enabled}" />
                          <mx:Label text="Country of Residence" />
                          <mx:List id="countryresidence" dataProvider="{new ArrayList (['US', 'AR', 'AU','AS', 'BE', 'BZ','CA','CH','FR'])}"
                              textAlign="left" verticalScrollPolicy="auto" height="100" width="50" allowMultipleSelection="true" />
                      </mx:FormItem>