[virtualcommons-svn] SF.net SVN: virtualcommons:[145] mentalmodels/trunk/flex/src
Status: Beta
Brought to you by:
alllee
From: <see...@us...> - 2009-05-22 00:49:37
|
Revision: 145 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=145&view=rev Author: seematalele Date: 2009-05-22 00:49:28 +0000 (Fri, 22 May 2009) Log Message: ----------- Added Block and QuestionGroup custom component. Working perfectly. Validation is also done. Added Question component also but it needs lot of improvement. Modified Paths: -------------- mentalmodels/trunk/flex/src/InitialiseDatabase.mxml mentalmodels/trunk/flex/src/customComponents/Module.mxml Added Paths: ----------- mentalmodels/trunk/flex/src/customComponents/Block.mxml mentalmodels/trunk/flex/src/customComponents/Question.mxml mentalmodels/trunk/flex/src/customComponents/QuestionGroup.mxml Modified: mentalmodels/trunk/flex/src/InitialiseDatabase.mxml =================================================================== --- mentalmodels/trunk/flex/src/InitialiseDatabase.mxml 2009-05-21 22:53:03 UTC (rev 144) +++ mentalmodels/trunk/flex/src/InitialiseDatabase.mxml 2009-05-22 00:49:28 UTC (rev 145) @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:net="flash.net.*" xmlns:comp="customComponents.*" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#FFFFFF, #80FFAA]" - width="760" height="510" clipContent="false" layout="absolute" currentState="none"> + width="100%" height="100%" clipContent="false" layout="absolute" currentState="none"> <mx:Script> <![CDATA[ import mx.effects.Fade; @@ -9,22 +9,28 @@ import mx.collections.XMLListCollection; import mx.controls.Alert; +/* id field of module, block and questiongroup and questions should come from database, +so when module info is transfered to the server, it should return the id for that module */ + [Bindable] private var company:XML = - <list> - <module title="Preexperiment" sequenceNo="200"> + + <module title="Preexperiment" sequenceNo="200" id="1"> <block name="John H"> - <item name="item"/> + <questiongroup header="hello" description="world" sequenceNo="200" id="1"/> + </block> - <block name="Sam K"/> + <block name="Sam K" /> + <block name="Erin M"/> + <block name="Ann B"/> </module> - <!--<module title="Operations" code="400"> + <module title="Operations" code="400"> <block name="Bill C"/> <block name="Jill W"/> </module> - <module title="Engineering" code="300"> + <!-- <module title="Engineering" code="300"> <block name="Erin M"/> <block name="Ann B"/> @@ -34,21 +40,25 @@ [Bindable] private var companyData:XMLListCollection = new XMLListCollection(company.module); - private function treeLabel(item:Object):String + private function treeLabel(item:Object):String { var node:XML = XML(item); if( node.localName() == "module" ) - return node.@title; - else + + + else if( node.localName() == "block" ) return node.@name; - + else if( node.localName() == "questiongroup" ) + return node.@header; + else + return node.@name; + } private function addModule():void - { currentState = "module"; @@ -56,6 +66,10 @@ var moduleInfo:Module = Module(obj); moduleInfo.reset(); btnsaveModule.enabled = true; + + btnsaveBlock.enabled = false; + btnsaveQuestionGroup.enabled = false; + btnsaveQuestion.enabled = false; /*var saveModule:Button = new Button; var isExists:Boolean = pnlComponent.contains(saveModule as DisplayObject); Alert.show(isExists.toString()); @@ -71,7 +85,7 @@ private function saveModule(event:Event):void { - //btnsaveModule.enabled = false; + var obj:DisplayObject = pnlComponent.getChildAt(1); var moduleInfo:Module = Module(obj); @@ -92,6 +106,7 @@ company.appendChild(newNode); currentState = "none"; btnsaveModule.enabled = false; + // pnlComponent.removeChildAt(1); } @@ -111,14 +126,22 @@ private function addBlock():void { + currentState = "block"; + var obj:DisplayObject = pnlComponent.getChildAt(1); + var blockInfo:Block = Block(obj); + blockInfo.reset(); + btnsaveBlock.enabled = true; + btnsaveModule.enabled = false; + btnsaveQuestionGroup.enabled = false; + btnsaveQuestion.enabled = false; + //currentState = "block"; - btnsaveModule.enabled = true; - + - var node:XML = tree.selectedItem as XML; + /*var node:XML = tree.selectedItem as XML; - Alert.show("Selected node is " + node.@title); + Alert.show("Selected node is " + node.@title);*/ /* var newNode:XML = <block/>; newNode.@name = "block1"; @@ -131,30 +154,206 @@ } - private function addItem():void - + private function saveBlock(event:Event):void { - var newNode:XML = <item/>; - newNode.@name = "item1"; - var module:XMLList =company.module.(@title == "first module"); - var i:int; - for (i = 0; i < module.length(); i++) - { - if(module[i].block.@name == "block1") - { - var item:XMLList =company.module.block.(@name == "block1"); - if( item.length() > 0 ) - { + + var obj:DisplayObject = pnlComponent.getChildAt(1); + var blockInfo:Block = Block(obj); + + var node:XML = tree.selectedItem as XML; + + if(tree.selectedItem == null) + { + Alert.show("Please select the module from tree to which block should be added."); + } + else + { - item[0].appendChild(newNode); - - } - } - } - - } + var isBlockFormValid:Boolean = blockInfo.validateForm(event); + if(isBlockFormValid) + { + var durationflag:Boolean = this.isDurationValid(blockInfo.getHours(),blockInfo.getMinutes(),blockInfo.getSeconds()); + if(durationflag) + { + Alert.show("Please enter the valid duration for the given block."); + } + else + { + var newNode:XML = <block/> + newNode.setLocalName("block"); + newNode.@name=blockInfo.getName(); + newNode.@sequenceNo =blockInfo.getSequenceNo(); + var module:XMLList =company.module.(@title == node.@title); + if( module.length() > 0 ) + { + module[0].appendChild(newNode); + currentState = "none"; + btnsaveBlock.enabled = false; + + } + + } + } + else + { + Alert.show("Please fill the form correctly"); + } + } + + } - + private function addQuestionGroup():void + { + currentState = "questionGroup"; + var obj:DisplayObject = pnlComponent.getChildAt(1); + var questionGroupInfo:QuestionGroup = QuestionGroup(obj); + questionGroupInfo.reset(); + + btnsaveModule.enabled = false; + btnsaveBlock.enabled = false; + btnsaveQuestionGroup.enabled = true; + btnsaveQuestion.enabled = false; + + + } + + private function saveQuestionGroup(event:Event):void + { + + + var node:XML = tree.selectedItem as XML; + + if(tree.selectedItem == null) + { + Alert.show("Please select the block from tree to which Question Group should be added."); + return; + } + else + { + + //if(tree.getParentItem(tree.selectedItem) == null) + if(node.localName() == "module") + { + Alert.show("You can not add QuestionGroup to Module."); + return; + } + else + { + if(node.localName() == "questiongroup" ) + { + Alert.show("You can not add QuestionGroup to QuestionGroup."); + return; + } + + else + { + //find out the parent module + var parentModule:XML = tree.getParentItem(tree.selectedItem) as XML; + var obj:DisplayObject = pnlComponent.getChildAt(1); + var questionGroupInfo:QuestionGroup = QuestionGroup(obj); + var isQuestionGroupFormValid:Boolean = questionGroupInfo.validateForm(event); + + if(isQuestionGroupFormValid) + { + + var newNode:XML = <questiongroup/>; + newNode.setLocalName("questiongroup"); + newNode.@header = questionGroupInfo.getHeader(); + newNode.@description = questionGroupInfo.getDescription(); + newNode.@sequenceNo = questionGroupInfo.getSequenceNo(); + + /*var module:XMLList = company.module.(@title == parentModule.@title); + //Alert.show("ParentModule node is: " + parentModule.@title); + Alert.show("ParentBlock node is: " + module.children().length()); + var blockList:XMLList = module.children(); + var i:int; + //Alert.show(module.length() + "is length of module"); + for (i = 0; i < blockList.length(); i++) + { + if(blockList[i].block.@name == node.@name) + { + Alert.show(blockList[i].block.@name + "is found"); + */ + var block:XMLList =company.module.block.(@name == node.@name); + Alert.show(block.@name + "is name of the block"); + if( block.length() > 0 ) + { + block[0].appendChild(newNode); + currentState = "none"; + btnsaveQuestionGroup.enabled = false; + + } + //} + //} + } + } + } + } + } + private function addQuestion():void + { + currentState = "question"; + var obj:DisplayObject = pnlComponent.getChildAt(1); + var questionGroupInfo:QuestionGroup = QuestionGroup(obj); + questionGroupInfo.reset(); + + btnsaveModule.enabled = false; + btnsaveBlock.enabled = false; + btnsaveQuestionGroup.enabled = false; + btnsaveQuestion.enabled = true; + } + + private function saveQuestion(event:Event):void + { + var node:XML = tree.selectedItem as XML; + + if(tree.selectedItem == null) + { + Alert.show("Please select the block from tree to which Question Group should be added."); + return; + } + else + { + + //if(tree.getParentItem(tree.selectedItem) == null) + if(node.localName() != "questiongroup") + { + Alert.show("You can add Question to QuestionGroup only."); + return; + } + else + { + //find out the parent module + var parentModule:XML = tree.getParentItem(tree.selectedItem) as XML; + var obj:DisplayObject = pnlComponent.getChildAt(1); + var questionInfo:Question = Question(obj); + var isQuestionGroupFormValid:Boolean = questionInfo.validateForm(event); + + if(isQuestionGroupFormValid) + { + + var newNode:XML = <question/>; + newNode.setLocalName("question"); + newNode.@header = questionInfo.getHeader(); + newNode.@description = questionInfo.getDescription(); + newNode.@sequenceNo = questionInfo.getSequenceNo(); + + var block:XMLList =company.module.block.(@name == node.@name); + Alert.show(block.@name + "is name of the block"); + if( block.length() > 0 ) + { + block[0].appendChild(newNode); + currentState = "none"; + btnsaveQuestion.enabled = false; + + } + } + } + } + + } + + private function removeEmployee():void { var node:XML = XML(tree.selectedItem); @@ -193,27 +392,36 @@ </mx:AddChild> </mx:State> - <!--<mx:State name="block"> + <mx:State name="block"> <mx:AddChild relativeTo="{pnlComponent}"> - <comp:SocioDemographicPage id="socioDemographic" x="265" y="100"/> + <comp:Block id="block"/> </mx:AddChild> </mx:State> - <mx:State name="item"> + <mx:State name="questionGroup"> <mx:AddChild relativeTo="{pnlComponent}"> - <comp:PlannerPage id="planner"/> + <comp:QuestionGroup id="questionGroup"/> </mx:AddChild> - </mx:State>--> + </mx:State> + <mx:State name="question"> + <mx:AddChild relativeTo="{pnlComponent}"> + <comp:Question id="question"/> + </mx:AddChild> + </mx:State> + + <mx:State name="none"/> </mx:states> - + <mx:Spacer width="40"/> <mx:HDividedBox width="100%" height="100%" id="hdMain"> + <mx:Spacer width="40"/> <mx:VBox height="100%" id="vboxLeft"> + <mx:Spacer width="40"/> <mx:Tree id="tree" top="72" left="50" dataProvider="{companyData}" labelFunction="treeLabel" allowMultipleSelection="false" selectable="true" showRoot="true" change="{treeChanged(event)}" - height="224" width="179" /> + height="50%" width="80%" textAlign="center"/> <mx:Canvas height="35%"> <mx:Grid x="0" y="0"> @@ -239,14 +447,26 @@ </mx:GridRow> <mx:GridRow width="100%" height="100%"> <mx:GridItem width="100%" height="100%"> - <mx:Button label="Add Item" id="butAddItem" click="{addItem()}"/> + <mx:Button label="Add QuestionGroup" id="butAddQuestionGroup" click="{addQuestionGroup()}"/> </mx:GridItem> + <mx:GridItem width="100%" height="100%"> - <mx:Button label="Remove Item" id="butremItem"/> + <mx:Button label="Remove QuestionGroup" id="butremQuestionGroup"/> </mx:GridItem> <mx:GridItem width="100%" height="100%"> </mx:GridItem> </mx:GridRow> + <mx:GridRow width="100%" height="100%"> + <mx:GridItem width="100%" height="100%"> + <mx:Button label="Add Question" id="butAddQuestion" click="{addQuestion()}"/> + </mx:GridItem> + + <mx:GridItem width="100%" height="100%"> + <mx:Button label="Remove Question" id="butremQuestion"/> + </mx:GridItem> + <mx:GridItem width="100%" height="100%"> + </mx:GridItem> + </mx:GridRow> </mx:Grid> </mx:Canvas> @@ -256,10 +476,12 @@ <mx:Spacer width="40"/> <mx:Button id = "btnsaveModule" label="Save Module" enabled="false" click="{saveModule(event)}"/> <mx:Spacer width="40"/> - <mx:Button id = "btnsaveBlock" enabled="false" label="Save Block" /> + <mx:Button id = "btnsaveBlock" enabled="false" label="Save Block" click="{saveBlock(event)}"/> <mx:Spacer width="40"/> - <mx:Button id = "btnsaveItem" enabled="false" label="Save Item" /> + <mx:Button id = "btnsaveQuestionGroup" enabled="false" label="Save QuestionGroup" click="{saveQuestionGroup(event)}" /> <mx:Spacer width="40"/> + <mx:Button id = "btnsaveQuestion" enabled="false" label="Save Question" click="{saveQuestion(event)}" /> + <mx:Spacer width="40"/> </mx:HBox> </mx:Panel> Added: mentalmodels/trunk/flex/src/customComponents/Block.mxml =================================================================== --- mentalmodels/trunk/flex/src/customComponents/Block.mxml (rev 0) +++ mentalmodels/trunk/flex/src/customComponents/Block.mxml 2009-05-22 00:49:28 UTC (rev 145) @@ -0,0 +1,138 @@ +<?xml version="1.0" encoding="utf-8"?> +<mx:Form xmlns:mx="http://www.adobe.com/2006/mxml"> +<mx:Script> + <![CDATA[ + import mx.validators.NumberValidator; + import mx.validators.Validator; + import mx.events.ValidationResultEvent; + import mx.controls.Alert; + + [Bindable] + public var formIsEmpty:Boolean = true; + + [Bindable] + public var formIsValid:Boolean = false; + + + // Holds a reference to the currently focussed + // control on the form. + private var focussedFormControl:DisplayObject; + + public function getSequenceNo():String + { + return txtSeqNo.text; + } + public function getName():String + { + return txtName.text; + } + /*public function getDuration():String + { + //return txtMajor.text; + }*/ + + public function getHours():Number + { + return hours.value; + + } + public function getMinutes():Number + { + return minutes.value; + + } + public function getSeconds():Number + { + return seconds.value; + + } + + public function validateForm(event:Event):Boolean + { + // Save a reference to the currently focussed form control + // so that the isValid() helper method can notify only + // the currently focussed form control and not affect + // any of the other form controls. + focussedFormControl = event.target as DisplayObject; + + // Mark the form as valid to start with + formIsValid = true; + + // Check if form is empty + formIsEmpty = (txtSeqNo.text == "" && txtName.text == ""); + + // Run each validator in turn, using the isValid() + // helper method and update the value of formIsValid + // accordingly. + validate(validateSeqNo); + return formIsValid; + + } + + private function validate(validator:Validator):Boolean + { + // Get a reference to the component that is the + // source of the validator. + var validatorSource:DisplayObject = validator.source as DisplayObject; + + // Suppress events if the current control being validated is not + // the currently focussed control on the form. This stops the user + // from receiving visual validation cues on other form controls. + // var suppressEvents:Boolean = (validatorSource != focussedFormControl); + var suppressEvents:Boolean = false; + // Carry out validation. Returns a ValidationResultEvent. + // Passing null for the first parameter makes the validator + // use the property defined in the property tag of the + // <mx:Validator> tag. + var event:ValidationResultEvent = validator.validate(null, suppressEvents); + + // Check if validation passed and return a boolean value accordingly. + var currentControlIsValid:Boolean = (event.type == ValidationResultEvent.VALID); + + // Update the formIsValid flag + formIsValid = formIsValid && currentControlIsValid; + + return currentControlIsValid; + } + + public function reset():void + { + txtSeqNo.text =""; + txtName.text = ""; + hours.value =0; + minutes.value =0; + seconds.value =0; + txtSeqNo.errorString =""; + txtName.errorString =""; + + } + + + + ]]> + </mx:Script> + <mx:FormHeading label="Block Information"/> + <mx:FormItem label="Sequence Number:"> + <mx:TextInput id="txtSeqNo" maxChars="3" change="{validateForm(event)}"/> + </mx:FormItem> + <mx:FormItem label="Description:"> + <mx:TextInput id="txtName" change="{validateForm(event)}"/> + </mx:FormItem> + +<mx:FormItem label="Duration(hr:min:sec):"> + <mx:HBox> + <!--<mx:TextInput id="txtDuration" maxChars="8"/>--> + <mx:NumericStepper id="hours" minimum="0" maximum="12" stepSize="1" change="{getHours()}"/> + <mx:Label text=":" textAlign="center"/> + <mx:NumericStepper id="minutes" minimum="0" maximum="60" stepSize="1" change="{getMinutes()}"/> + <mx:Label text=":" textAlign="center"/> + <mx:NumericStepper id="seconds" minimum="0" maximum="60" stepSize="1" change="{getSeconds()}"/> + </mx:HBox> + + + + +</mx:FormItem> +<mx:NumberValidator id ="validateSeqNo" source="{txtSeqNo}" property="text" minValue="1" maxValue="1000" domain="int"/> + +</mx:Form> Modified: mentalmodels/trunk/flex/src/customComponents/Module.mxml =================================================================== --- mentalmodels/trunk/flex/src/customComponents/Module.mxml 2009-05-21 22:53:03 UTC (rev 144) +++ mentalmodels/trunk/flex/src/customComponents/Module.mxml 2009-05-22 00:49:28 UTC (rev 145) @@ -113,6 +113,7 @@ ]]> </mx:Script> + <mx:FormHeading label="Module Information"/> <mx:FormItem label="Sequence Number:"> <mx:TextInput id="txtSeqNo" maxChars="3" change="{validateForm(event)}"/> </mx:FormItem> Added: mentalmodels/trunk/flex/src/customComponents/Question.mxml =================================================================== --- mentalmodels/trunk/flex/src/customComponents/Question.mxml (rev 0) +++ mentalmodels/trunk/flex/src/customComponents/Question.mxml 2009-05-22 00:49:28 UTC (rev 145) @@ -0,0 +1,125 @@ +<?xml version="1.0" encoding="utf-8"?> +<mx:Form xmlns:mx="http://www.adobe.com/2006/mxml" width="80%" height="100%"> + <mx:Script> + <![CDATA[ + import mx.validators.NumberValidator; + import mx.validators.Validator; + import mx.events.ValidationResultEvent; + import mx.controls.Alert; + + [Bindable] + public var formIsEmpty:Boolean = true; + + [Bindable] + public var formIsValid:Boolean = false; + + + // Holds a reference to the currently focussed + // control on the form. + private var focussedFormControl:DisplayObject; + + public function getSequenceNo():String + { + return txtSeqNo.text; + } + public function getQuestion():String + { + return txtQuestion.text; + } + + /*public function getDescription():String + { + return txtDescription.text; + }*/ + + + + public function validateForm(event:Event):Boolean + { + // Save a reference to the currently focussed form control + // so that the isValid() helper method can notify only + // the currently focussed form control and not affect + // any of the other form controls. + focussedFormControl = event.target as DisplayObject; + + // Mark the form as valid to start with + formIsValid = true; + + // Check if form is empty + formIsEmpty = (txtSeqNo.text == "" && txtQuestion.text == ""); + + // Run each validator in turn, using the isValid() + // helper method and update the value of formIsValid + // accordingly. + validate(validateSeqNo); + return formIsValid; + + } + + private function validate(validator:Validator):Boolean + { + // Get a reference to the component that is the + // source of the validator. + var validatorSource:DisplayObject = validator.source as DisplayObject; + + // Suppress events if the current control being validated is not + // the currently focussed control on the form. This stops the user + // from receiving visual validation cues on other form controls. + // var suppressEvents:Boolean = (validatorSource != focussedFormControl); + var suppressEvents:Boolean = false; + // Carry out validation. Returns a ValidationResultEvent. + // Passing null for the first parameter makes the validator + // use the property defined in the property tag of the + // <mx:Validator> tag. + var event:ValidationResultEvent = validator.validate(null, suppressEvents); + + // Check if validation passed and return a boolean value accordingly. + var currentControlIsValid:Boolean = (event.type == ValidationResultEvent.VALID); + + // Update the formIsValid flag + formIsValid = formIsValid && currentControlIsValid; + + return currentControlIsValid; + } + + public function reset():void + { + txtSeqNo.text =""; + txtQuestion.text = ""; + + txtSeqNo.errorString =""; + txtQuestion.errorString =""; + + } + + ]]> + </mx:Script> + + <mx:FormHeading label="QuestionGroup"/> + <mx:FormItem label="Sequence Number:"> + <mx:TextInput id="txtSeqNo" maxChars="3" change="{validateForm(event)}"/> + </mx:FormItem> + <mx:FormItem label="Question:"> + <mx:TextInput id="txtQuestion" change="{validateForm(event)}"/> + </mx:FormItem> + <mx:FormItem label="Select Question Type:"> + <mx:ComboBox id="cmbType" change="{validateForm(event)}" width="100%"> + <mx:ArrayCollection> + <mx:String>-Select-</mx:String> + <mx:String>Categorical</mx:String> + <mx:String>Psychometric</mx:String> + </mx:ArrayCollection> + </mx:ComboBox> + + </mx:FormItem> + <mx:FormItem> + <mx:Panel width="250" height="200" layout="absolute"> + + </mx:Panel> + </mx:FormItem> + + + +<mx:NumberValidator id ="validateSeqNo" source="{txtSeqNo}" property="text" minValue="1" maxValue="1000" domain="int"/> + +</mx:Form> Added: mentalmodels/trunk/flex/src/customComponents/QuestionGroup.mxml =================================================================== --- mentalmodels/trunk/flex/src/customComponents/QuestionGroup.mxml (rev 0) +++ mentalmodels/trunk/flex/src/customComponents/QuestionGroup.mxml 2009-05-22 00:49:28 UTC (rev 145) @@ -0,0 +1,111 @@ +<?xml version="1.0" encoding="utf-8"?> +<mx:Form xmlns:mx="http://www.adobe.com/2006/mxml"> + <mx:Script> + <![CDATA[ + import mx.validators.NumberValidator; + import mx.validators.Validator; + import mx.events.ValidationResultEvent; + import mx.controls.Alert; + + [Bindable] + public var formIsEmpty:Boolean = true; + + [Bindable] + public var formIsValid:Boolean = false; + + + // Holds a reference to the currently focussed + // control on the form. + private var focussedFormControl:DisplayObject; + + public function getSequenceNo():String + { + return txtSeqNo.text; + } + public function getHeader():String + { + return txtHeader.text; + } + public function getDescription():String + { + return txtDescription.text; + } + + + public function validateForm(event:Event):Boolean + { + // Save a reference to the currently focussed form control + // so that the isValid() helper method can notify only + // the currently focussed form control and not affect + // any of the other form controls. + focussedFormControl = event.target as DisplayObject; + + // Mark the form as valid to start with + formIsValid = true; + + // Check if form is empty + formIsEmpty = (txtSeqNo.text == "" && txtHeader.text == "" && txtDescription.text == ""); + + // Run each validator in turn, using the isValid() + // helper method and update the value of formIsValid + // accordingly. + validate(validateSeqNo); + return formIsValid; + + } + + private function validate(validator:Validator):Boolean + { + // Get a reference to the component that is the + // source of the validator. + var validatorSource:DisplayObject = validator.source as DisplayObject; + + // Suppress events if the current control being validated is not + // the currently focussed control on the form. This stops the user + // from receiving visual validation cues on other form controls. + // var suppressEvents:Boolean = (validatorSource != focussedFormControl); + var suppressEvents:Boolean = false; + // Carry out validation. Returns a ValidationResultEvent. + // Passing null for the first parameter makes the validator + // use the property defined in the property tag of the + // <mx:Validator> tag. + var event:ValidationResultEvent = validator.validate(null, suppressEvents); + + // Check if validation passed and return a boolean value accordingly. + var currentControlIsValid:Boolean = (event.type == ValidationResultEvent.VALID); + + // Update the formIsValid flag + formIsValid = formIsValid && currentControlIsValid; + + return currentControlIsValid; + } + + public function reset():void + { + txtSeqNo.text =""; + txtHeader.text = ""; + txtDescription.text =""; + txtSeqNo.errorString =""; + txtHeader.errorString =""; + txtDescription.errorString =""; + + } + + ]]> + </mx:Script> + + <mx:FormHeading label="QuestionGroup"/> + <mx:FormItem label="Sequence Number:"> + <mx:TextInput id="txtSeqNo" maxChars="3" change="{validateForm(event)}"/> + </mx:FormItem> + <mx:FormItem label="Header:"> + <mx:TextInput id="txtHeader" change="{validateForm(event)}"/> + </mx:FormItem> + <mx:FormItem label="Decsription:"> + <mx:TextArea id="txtDescription" change="{validateForm(event)}" width="100%" height="100"/> + </mx:FormItem> + + +<mx:NumberValidator id ="validateSeqNo" source="{txtSeqNo}" property="text" minValue="1" maxValue="1000" domain="int"/> + +</mx:Form> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |