Explicitly handing validator validation events : Validator « Development « Flex






Explicitly handing validator validation events

Explicitly handing validator validation events
        

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
  <mx:Script>
    
    import mx.events.ValidationResultEvent;
    private function handleValid(event:ValidationResultEvent):void {
      if(event.type==ValidationResultEvent.VALID)
        submitButton.enabled = true;
      else
        submitButton.enabled = false;
    }
    private function submitForm():void {
    }
    
  </mx:Script>
  <mx:ZipCodeValidator source="{inputZip}" property="text"
    valid="handleValid(event);" invalid="handleValid(event);" />
  <mx:TextInput id="inputZip" />
  <mx:TextInput id="inputPn" />
  <mx:Button id="submitButton" label="Submit" enabled="false" click="submitForm();" />
</mx:Application>

   
    
    
    
    
    
    
    
  








Related examples in the same category

1.A basic validator for requirementA basic validator for requirement
2.Set source and trigger for validatorSet source and trigger for validator
3.Set source and property for ValidatorSet source and property for Validator
4.Validate model data with ValidatorValidate model data with Validator
5.Declare validators in ActionScriptDeclare validators in ActionScript
6.Assigning a validator to the data modelAssigning a validator to the data model
7.Set validator property to textSet validator property to text
8.Set validator domainSet validator domain
9.Validator returns ValidationResultEventValidator returns ValidationResultEvent
10.Use Validator.validateAll() to invoke validators in an ArrayUse Validator.validateAll() to invoke validators in an Array
11.Assign validator targetAssign validator target
12.MXML validator classesMXML validator classes
13.Call validator validate method in button click action handlerCall validator validate method in button click action handler
14.Use a Button control to invoke a validatorUse a Button control to invoke a validator
15.Use Validators in functionUse Validators in function
16.Run a list of validators defined in an ArrayRun a list of validators defined in an Array
17.Display validation result for a list of validator one by oneDisplay validation result for a list of validator one by one
18.Use a validator along with a data binding to validateUse a validator along with a data binding to validate
19.Create and invoke a validator programmatically in when a user clicks a Button controlCreate and invoke a validator programmatically in when a user clicks a Button control
20.Invoking multiple validators in a functionInvoking multiple validators in a function
21.Use Validator defined in MXML and call its validate methodUse Validator defined in MXML and call its validate method
22.Create an array with the validatorsCreate an array with the validators
23.Create and invoke a validator programmatically when a user clicks a Button controlCreate and invoke a validator programmatically when a user clicks a Button control
24.Use method to invoke two validators in response to the click event for the Button controlUse method to invoke two validators in response to the click event for the Button control
25.Use a Button control to invoke a validator, but the application first determines which validator to executeUse a Button control to invoke a validator, but the application first determines which validator to execute
26.Use Email validatorUse Email validator
27.Use Array.filter() filter out disabled validatorUse Array.filter() filter out disabled validator
28.Use button event to trigger a validation eventUse button event to trigger a validation event
29.ActionScript based ValidationActionScript based Validation
30.Form data validationForm data validation
31.Triggering validation by using eventsTriggering validation by using events
32.Triggering validation by using the default eventTriggering validation by using the default event
33.Call validation method in a user methodCall validation method in a user method
34.ValidationResultEvent propertyValidationResultEvent property
35.Changing the color of the validation error messageChanging the color of the validation error message
36.Clearing a validation errorClearing a validation error
37.Validate one component but have validation results apply to a different componentValidate one component but have validation results apply to a different component
38.Explicitly handling component validation eventsExplicitly handling component validation events
39.More than one field date validationMore than one field date validation
40.Data Validation Through EventsData Validation Through Events
41.Data Validation Through ActionScriptData Validation Through ActionScript
42.Triggering validation with EventsTriggering validation with Events
43.Write the performValidation() functionWrite the performValidation() function
44.Perform a validation on a required input fieldPerform a validation on a required input field
45.Reset Value based on validation resultReset Value based on validation result
46.Set errorString to create an error tip without performing any validationSet errorString to create an error tip without performing any validation
47.validate handler and invalid handlervalidate handler and invalid handler
48.Run the validate() method and assign the result to a variableRun the validate() method and assign the result to a variable
49.Required field Error messageRequired field Error message