Changing a Flex FormItem container’s indicator skin

by Peter deHaan on October 6, 2007

in Form, FormHeading, FormItem, Forms

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.

View MXML

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/10/06/changing-a-flex-formitem-containers-indicator-skin/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="top"
        backgroundColor="white">

    <mx:Style>
        FormItem {
            indicatorSkin: Embed(source="assets/asterisk_yellow.png");
            indicatorGap: 24; /* pixels */
        }

        FormItemLabel {
            textAlign: left;
        }
    </mx:Style>

    <mx:Form>
        <mx:FormHeading label="FORM HEADING" />
        <mx:FormItem label="Name:" required="true">
            <mx:TextInput />
        </mx:FormItem>
        <mx:FormItem label="Email:" required="true">
            <mx:TextInput />
        </mx:FormItem>
        <mx:FormItem label="Phone number:">
            <mx:TextInput />
        </mx:FormItem>
    </mx:Form>

</mx:Application>

View source is enabled in the following example.

{ 4 comments… read them below or add one }

1 Anonymous October 7, 2007 at 6:18 am

This is fun

Reply

2 serge October 11, 2007 at 5:09 am

yes

Reply

3 Anonymous May 19, 2008 at 1:50 pm

Is there an easy way to move the indicator in front of the label?

Reply

4 Chetan Sachdev August 1, 2008 at 5:30 am

Is it possible to move required indicator to left ? I want to have it next to label (Form Item).

Reply

Leave a Comment

Sorry, this blog is terrible at eating HTML comments.
If you're pasting any HTML/XML/MXML code, you need to convert your < characters to &lt; and your > characters to &gt; .

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Anti-Spam Protection by WP-SpamFree

Previous post:

Next post: