Use button event to trigger a validation event : Validator « Development « Flex

Home
Flex
1.Chart
2.Components
3.Container
4.Data Model
5.Development
6.Effects
7.Event
8.Graphics
9.Grid
10.Style
Flex » Development » ValidatorScreenshots 
Use button event to trigger a validation event
Use button event to trigger a validation event
          

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">


  <mx:Script>
    
      private function runValidator(event:MouseEvent):void {
        validator.validate( );
      }

  
  </mx:Script>

  <mx:Form>
    <mx:FormItem label="Name">
      <mx:TextInput id="username"/>
    </mx:FormItem>
    <mx:FormItem>
      <mx:Button id="button" label="Submit" click="runValidator(event)" />
    </mx:FormItem>
  </mx:Form>

  <mx:Validator id="validator" source="{username}" property="text" trigger="{null}" />

</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.Explicitly handing validator validation eventsExplicitly handing validator validation events
22.Use Validator defined in MXML and call its validate methodUse Validator defined in MXML and call its validate method
23.Create an array with the validatorsCreate an array with the validators
24.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
25.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
26.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
27.Use Email validatorUse Email validator
28.Use Array.filter() filter out disabled validatorUse Array.filter() filter out disabled validator
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
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.