PhoneNumberValidator in Flex4


 

PhoneNumberValidator in Flex4

The PhoneNumberValidator class is used for a valid phone number. A valid phone number has a 10 digits.

The PhoneNumberValidator class is used for a valid phone number. A valid phone number has a 10 digits.

PhoneNumberValidator in Flex4:

The PhoneNumberValidator class is used for a valid phone number. A valid phone number has a 10 digits. If the user enter less than or greater than 10 digits it will generate a error message.
The tag of PhoneNumberValidator is <mx:PhoneNumberValidator>.

Example:

<?xml version="1.0" encoding="utf-8"?>

<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"

minWidth="955" minHeight="600">

<fx:Script>

<![CDATA[

import mx.controls.Alert;

]]>

</fx:Script>

<fx:Declarations>

<mx:PhoneNumberValidator id="pnum"

source="{phonetxt}"

property="text"

trigger="{btn}"

triggerEvent="click"

valid="Alert.show('Submitted Successfully');"/>

</fx:Declarations>

<s:Panel title="PhoneNumberValidator Example" width="570">

<mx:Form width="568" backgroundColor="#101446" color="#FFFFFF" height="94">

<mx:FormItem label="Enter Phone No.">

<s:TextInput id="phonetxt" width="100%" color="#000000"/>

</mx:FormItem>

<mx:FormItem>

<s:Button id="btn"

label="Check Validation"

chromeColor="#5F1B0C"/>

</mx:FormItem>

</mx:Form>

0

</s:Panel>

</s:Application>

Output:

1

Running Application:

To view this page ensure that Adobe Flash Player version 10.0.0 or greater is installed.

Download this code

2

Ads