Hi
In this case you need to do two things

1. Assign an empty string to requiredFielError property in
StringValidator so that now errortip occurs but your component's
border will still appear as red(so that user can make out which field
is required)

2.You need to create a custom tooltip with error style for your
textfield on rollover event & destroy it on rollout. You will enable
the tooltip whenever your ValidationResult.isError returns
true(ValidationResult is return type of validator.validate function)

For creating custom error tooltip refer to this link :
http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7f5c.html

On Mar 29, 5:01 pm, flex <[email protected]> wrote:
> hi all
> i want to show error in fromitem(of flex 4 spark form)   as  a tooltip
> like we show in flex 3 form
> Now error displaying beside of textinputs and it resizes my
> application
> is there any solution ?
>
> thank you
>
> see sample code
> <s:WindowedApplication name="Spark_FormItem_errorIndicatorSource_test"
>                            xmlns:fx="http://ns.adobe.com/mxml/2009";
>                            xmlns:s="library://ns.adobe.com/flex/spark"
>                            xmlns:mx="library://ns.adobe.com/flex/mx">
>         <s:layout>
>                 <s:VerticalLayout horizontalAlign="center" 
> verticalAlign="middle" />
>         </s:layout>
>
>         <fx:Script>
>                 <![CDATA[
>                         import mx.validators.Validator;
>
>                         protected function 
> resetBtn_clickHandler(evt:MouseEvent):void {
>                                 username.text = "";
>                                 password1.text = "";
>                                 password2.text = "";
>                                 username.errorString = "";
>                                 password1.errorString = "";
>                         }
>
>                         protected function 
> submitBtn_clickHandler(evt:MouseEvent):void {
>                                 Validator.validateAll(valArr);
>                         }
>                 ]]>
>         </fx:Script>
>
>         <fx:Declarations>
>                 <fx:Array id="valArr">
>                         <mx:StringValidator source="{username}" 
> property="text"
> required="true" minLength="4" />
>                         <mx:StringValidator source="{password1}" 
> property="text"
> required="true" minLength="4" />
>                 </fx:Array>
>         </fx:Declarations>
>
>         <s:Form id="frm" defaultButton="{submitBtn}"
> backgroundColor="#EEEEEE">
>                 <s:FormHeading label="Spark Form Heading"
> backgroundColor="haloSilver" />
>                 <s:FormItem sequenceLabel="1." label="Username:" 
> required="true">
>                         <s:helpContent>
>                                 <s:Label text="[email protected]" />
>                         </s:helpContent>
>                         <s:TextInput id="username" />
>                 </s:FormItem>
>                 <s:FormItem sequenceLabel="2." label="Password:" 
> required="true">
>                         <s:helpContent>
>                                 <s:Label text="weak" color="red" />
>                         </s:helpContent>
>                         <s:TextInput id="password1" displayAsPassword="true" 
> />
>                 </s:FormItem>
>                 <s:FormItem sequenceLabel="3." label="Confirm password:">
>                         <s:helpContent>
>                                 <s:HGroup>
>                                         <s:Label text="One" color="red" />
>                                         <s:Label text="Two" color="blue" />
>                                 </s:HGroup>
>                         </s:helpContent>
>                         <s:TextInput id="password2" displayAsPassword="true" 
> />
>                 </s:FormItem>
>                 <s:FormItem>
>                         <s:layout>
>                                 <s:HorizontalLayout />
>                         </s:layout>
>                         <s:Button id="resetBtn" label="Reset"
> click="resetBtn_clickHandler(event);" />
>                         <s:Button id="submitBtn" label="Submit"
> click="submitBtn_clickHandler(event);" />
>                 </s:FormItem>
>         </s:Form>
>
> </s:WindowedApplication>

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to