Home > Adobe Flex > Flex Required Field Indicator

Flex Required Field Indicator

Ever wanted to create your own textual component that sits outside of a Flex Form (and FormItem tag) that still uses the same required field indicator?

After trying to duplicate the little red asterisk using styles or even creating my own graphically, I opted to use the same one that comes part of the Flex SDK inside Assets.swf:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml"
    horizontalGap="0" verticalAlign="middle" horizontalAlign="right" 
    height="18" width="100%"
    paddingBottom="0" paddingTop="0"
    styleName="requiredFieldLabel">
 
	<mx:Image 
	    source="@Embed(source='Assets.swf',symbol='mx.containers.FormItem.Required')" 
	    height="7"/>
 
	<mx:Label text="indicates required field" 
	    styleName="requiredFieldLabel"/>
 
</mx:HBox>

Here’s what you’d see:
required_field

Categories: Adobe Flex Tags:
  1. February 28th, 2009 at 00:16 | #1

    Thank you!

  2. March 14th, 2009 at 06:21 | #2

    This is the first time I commented here and I must say that you give us genuine, and quality information for other bloggers! Great job.
    p.s. You have a very good template for your blog. Where did you find it?

  3. August 27th, 2009 at 15:26 | #4

    Hi!

    How can I do to make the red asterisk appear to the right of an input text box in flex?

    Regards

    • September 15th, 2009 at 11:50 | #5

      Easy…just swap the Image and Label tags. Since they both reside inside of an HBox (horizontal box), the first tag listed will appear left-most on the screen. So you want to write this instead:

  4. Alejandro
    January 7th, 2011 at 10:16 | #6

    Hi, I think that your example could Work for me but I dont understand how to use it. Can you explain to me. I need to indicate in all my requiered fields using an asterisk but I canĀ“t use a form.
    Thanks

  5. DSL
    November 20th, 2013 at 07:09 | #7

    Thanks a lot…..

  1. No trackbacks yet.