Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You could just attach two validator to the same field. The only problem is that there are situations where both event could be triggered. For example if you show a pop up when on text input tou will also focus out.</p> <p>Howevere this is a working example:</p> <pre><code>&lt;s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx"&gt; &lt;fx:Script&gt; &lt;![CDATA[ import mx.events.ValidationResultEvent; protected function stringvalidator1_validHandler(event:ValidationResultEvent):void { trace("Validated testInput"); } protected function stringvalidator1_invalidHandler(event:ValidationResultEvent):void { trace("Invalidated testInput"); } protected function stringvalidator2_validHandler(event:ValidationResultEvent):void { trace("Validated focusOut"); } protected function stringvalidator2_invalidHandler(event:ValidationResultEvent):void { trace("Invalidated focusOut"); } ]]&gt; &lt;/fx:Script&gt; &lt;fx:Declarations&gt; &lt;mx:StringValidator source="{fname}" minLength="4" maxLength="20" property="text" valid="stringvalidator1_validHandler(event)" invalid="stringvalidator1_invalidHandler(event)" triggerEvent="{TextEvent.TEXT_INPUT}"/&gt; &lt;mx:StringValidator source="{fname}" minLength="4" maxLength="20" property="text" valid="stringvalidator2_validHandler(event)" invalid="stringvalidator2_invalidHandler(event)" triggerEvent="{FocusEvent.FOCUS_OUT}"/&gt; &lt;/fx:Declarations&gt; &lt;s:Panel title="StringValidator Example" width="75%" height="75%" horizontalCenter="0" verticalCenter="0"&gt; &lt;mx:Form left="10" right="10" top="10" bottom="10"&gt; &lt;mx:FormItem label="Enter a name between 4 and 20 characters: "&gt; &lt;s:TextInput id="fname" width="100%"/&gt; &lt;/mx:FormItem&gt; &lt;/mx:Form&gt; &lt;/s:Panel&gt; &lt;/s:Application&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload