From the category archives:

FormItem

The following example shows how you can set the label width on a Form container in Flex by setting the labelWidth style.

Full code after the jump.

[click to continue…]

{ 0 comments }

The following example shows how you can toggle FormItem containers in a Flex Form container by setting the includeInLayout and visible properties.

Full code after the jump.

[click to continue…]

{ 3 comments }

The following example shows how you can set the text alignment on a Flex FormItem container’s label by setting the textAlign and labelStyleName styles.

Full code after the jump.

[click to continue…]

{ 10 comments }

The following example shows how you can access the Label subcomponent in a Flex FormItem container and do fancy stuff like have form labels with hyperlinks or selectable text by using the itemLabel property.

Full code after the jump.

[click to continue…]

{ 0 comments }

The following example shows how you can align form items horizontally by setting the horizontalAlign style to “left”, “center”, or “right” on the Flex FormItem container.

Full code after the jump.

[click to continue…]

{ 6 comments }

The following example shows how you can change the direction of a FormItem container in Flex by setting the direction property to “horizontal” or “vertical”.

Full code after the jump.

[click to continue…]

{ 0 comments }

The following example shows how you can set a custom indicator skin on a Flex FormItem container by setting the indicatorSkin style.

Full code after the jump.

[click to continue…]

{ 0 comments }

The following example shows you how you can style individual labels in a FormItem container in Flex by setting the labelStyleName style, as seen in the following snippet:

<mx:Style>
    .requiredLabel {
        color: red;
        fontSize: 12;
        fontWeight: bold;
    }
</mx:Style>

<mx:Form>
    <mx:FormItem label="Field 1:"
            labelStyleName="requiredLabel"
            required="true">
        <mx:Label id="lbl1" text="{str}" />
    </mx:FormItem>
</mx:Form>

The labelStyleName style was added in Flex 3 build 186889 (Wed Nov 07 2007 or later). You may need to download a nightly build of the Flex 3 SDK from the Adobe Labs website.

Full code after the jump.

[click to continue…]

{ 0 comments }

Setting the gap around the required indicator in a Flex form

by Peter deHaan November 6, 2007

The following example shows how you can set the gap around the required indicator in a Flex form by setting the indicatorGap style, as seen in the following snippet:

<mx:Style>
FormItem {
indicatorGap: 24;
}
</mx:Style>

Full code after the jump.

Read the full article →

Changing a Flex FormItem container’s indicator skin

by Peter deHaan October 6, 2007

The following example shows how you can change the FormItem container’s indicator skin which appears when the form item’s required property is set to true.
Full code after the jump.

Read the full article →

Building a simple tip calculator in Flex

by Peter deHaan September 17, 2007

The following example shows a very simple (and probably somewhat buggy) tip calculator which I put together in a few minutes using Flex. Nothing really new, but sometimes its fun to combine a few of the things we’ve covered over the past posts and build something a bit more interesting.
Full code after the jump.

Read the full article →

Changing a form item’s background color when a child control has focus

by Peter deHaan September 16, 2007

I recently saw this on the Interwebs and thought I’d try to rebuild the effect in Flex. It is a pretty nice way to highlight the currently active form item.
The following example shows how you can use the focusIn and focusOut events to highlight the currently focused form item.
Full code after the jump.

Read the full article →