Menu

[r327]: / cairngorm3 / trunk / libraries / ValidationTest / src / SampleModelValidationWithCombos.mxml  Maximize  Restore  History

Download this file

69 lines (59 with data), 2.6 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
layout="vertical"
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:validators="com.adobe.cairngorm.validation.*">
<mx:Script>
<![CDATA[
import combo.ComboPM;
[Bindable]
private var pm:ComboPM = new ComboPM();
]]>
</mx:Script>
<validators:ValidatorGroupSubscriber>
<validators:ValidatorSubscriber validator="{ pm.domain.validatorGroup.firstnameValidator }"
listener="{ firstNamesCombo }"/>
<validators:ValidatorSubscriber validator="{ pm.domain.validatorGroup.lastnameValidator }"
listener="{ lastNamesCombo }"/>
</validators:ValidatorGroupSubscriber>
<mx:Form width="300">
<mx:FormItem label="firstnames">
<mx:ComboBox id="firstNamesCombo"
dataProvider="{ pm.firstNames }"
change="pm.selectFirstName(firstNamesCombo.selectedItem)"
prompt="Select"/>
</mx:FormItem>
<mx:FormItem label="lastnames">
<mx:ComboBox id="lastNamesCombo"
dataProvider="{ pm.lastNames }"
change="pm.selectLastName(lastNamesCombo.selectedItem)"
prompt="Select"/>
</mx:FormItem>
<mx:FormItem
width="100%"
backgroundColor="{ pm.domain.validatorGroup.isValid ? 0xFF00 : 0xFF0000 }"
label="FORM VALIDITY">
<mx:Label text="{ pm.domain.validatorGroup.isValid }"/>
</mx:FormItem>
<mx:FormItem label="Boolean test">
<mx:ToggleButtonBar id="boolTestInput" itemClick="pm.setA( event.index == 0 ? false : true )">
<mx:dataProvider>
<mx:Array>
<mx:String>False</mx:String>
<mx:String>True</mx:String>
</mx:Array>
</mx:dataProvider>
</mx:ToggleButtonBar>
</mx:FormItem>
</mx:Form>
<mx:Button
label="force validation"
click="pm.domain.validatorGroup.validate()"/>
<mx:Button
label="reset listeners"
click="pm.domain.validatorGroup.reset()"/>
<mx:Button
fillColors="{ pm.domain.validatorGroup.enabled ? [ 0xFF00, 0xCC00 ] : [ 0xFF0000, 0xCC0000 ] }"
label="{ pm.domain.validatorGroup.enabled ? 'disable ' : 'enable ' } validatorGroup"
click="pm.domain.validatorGroup.enabled = !pm.domain.validatorGroup.enabled"/>
</mx:Application>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.