import com.adobe.crypto.SHA256; import com.hurlant.math.bi_internal; import com.imt.intimamedia.events.user.RegisterEvent; import com.imt.intimamedia.events.user.SearchCitiesEvent; import com.imt.intimamedia.events.user.SearchZipCodesEvent; import com.imt.intimamedia.events.user.TermsEvent; import com.imt.intimamedia.events.user.ValidateAccountEvent; import com.imt.intimamedia.helpers.FormatString; import com.imt.intimamedia.helpers.TextInputWithSkin; import com.imt.intimamedia.helpers.WindowShadeButton; import com.imt.intimamedia.model.ApplicationModelLocator; import com.imt.intimamedia.views.common.ImtToaster; import com.imt.intimamedia.views.general.register.ApplicationDatabaseTermsPopUp; import com.imt.intimamedia.views.general.register.ApplicationTermsPopUp; import com.imt.intimamedia.vo.HospitalVo; import com.imt.intimamedia.vo.PersonVo; import com.imt.intimamedia.vo.ProbeVo; import com.imt.intimamedia.vo.UltraSoundScannerVo; import com.imt.intimamedia.vo.UserVo; import flash.events.Event; import flash.events.MouseEvent; import flash.net.URLLoader; import flash.net.URLRequest; import flash.net.URLStream; import mx.automation.delegates.controls.TextInputAutomationImpl; import mx.collections.ArrayCollection; import mx.containers.FormItem; import mx.controls.Alert; import mx.controls.ComboBox; import mx.controls.Menu; import mx.core.Application; import mx.events.ListEvent; import mx.events.MenuEvent; import mx.events.ToolTipEvent; import mx.events.ValidationResultEvent; import mx.managers.PopUpManager; import mx.resources.ResourceManager; import mx.utils.ObjectUtil; import mx.validators.Validator; import flash.net.navigateToURL; [Bindable] private var _model : ApplicationModelLocator = ApplicationModelLocator.getInstance(); [Bindable] private var _maxYear : int = new Date().fullYear; [Bindable] private var _otherActivityActive : Boolean = false; private var _updateAddressManually : Boolean = false; private var _conditionsAreRead : Boolean = false; [Bindable] private var _partOneValid : Boolean = false; [Bindable] private var _partTwoValid : Boolean = false; [Bindable] private var _partThreeValid : Boolean = false; private var _terms : URLLoader; private var _idTermsAccepted : int = 0; private var _countrySelected : String = ""; private function actionOnZonesFromErrors( event : Event, zone : String ) : void { /*switch( zone ) { case "ZoneOne": ids.opened = !ids.opened; if( ids.opened ) { organization.opened = false; user.opened = false; scanner.opened = false; vatContainer.opened = false; mathContainer.opened = false; } break; case "ZoneTwo": organization.opened = !organization.opened; user.opened = !user.opened; scanner.opened = !scanner.opened; if( organization.opened ) { ids.opened = false; vatContainer.opened = false; mathContainer.opened = false; } break; }*/ } private function actionOnZones( event : Event, zone : String ) : void { /*if( event.target is WindowShadeButton ) { switch( zone ) { case "ZoneOne": ids.opened = !ids.opened; if( ids.opened ) { organization.opened = false; user.opened = false; scanner.opened = false; vatContainer.opened = false; mathContainer.opened = false; } break; case "ZoneTwo": organization.opened = !organization.opened; user.opened = !user.opened; scanner.opened = !scanner.opened; if( organization.opened ) { ids.opened = false; vatContainer.opened = false; mathContainer.opened = false; } break; case "ZoneThree": vatContainer.opened = !vatContainer.opened; mathContainer.opened = !mathContainer.opened; if( vatContainer.opened ) { ids.opened = false; organization.opened = false; user.opened = false; scanner.opened = false; } break; } }*/ } private function displayShippingAddress( selected : Boolean ) : void { _updateAddressManually = selected; shippingAddressTextInput.text = ""; shippingAddressLabel.visible = selected; shippingAddressLabel.includeInLayout = selected; copyAddress( invoiceAddressTextInput.text ); } private function copyAddress( address : String ) : void { if( !_updateAddressManually ) shippingAddressTextInput.text = address; } private function copyCountry( ) : void { if( countryComboBox.selectedIndex != -1 ) _countrySelected = countryComboBox.selectedItem.code; } private function searchCityWithZipCode() : void { if( countryComboBox.selectedIndex != -1 ) { _model.cities = new ArrayCollection(); new SearchCitiesEvent( zipCodeTextInput.text, countryComboBox.selectedItem.code ).dispatch(); var menuZipCode : Menu = Menu.createMenu( null, _model.cities, false ); menuZipCode.addEventListener( MenuEvent.ITEM_CLICK, citySelected ); menuZipCode.width = cityTextInput.width; menuZipCode.show( 258, 307 ); } else { var toastMessage : ImtToaster = new ImtToaster(); toastMessage.titleMessage = ResourceManager.getInstance().getString( 'labels', 'register.searchImpossibleTitle' ); toastMessage.message = ResourceManager.getInstance().getString( 'labels', 'register.searchImpossibleZip' ); toastMessage.level = ImtToaster.WARNING; ApplicationModelLocator.getInstance().toaster.toast( toastMessage ); } } private function searchZipCodeWithCity() : void { if( countryComboBox.selectedIndex != -1 ) { _model.zipCodes = new ArrayCollection(); new SearchZipCodesEvent( cityTextInput.text, countryComboBox.selectedItem.code ).dispatch(); var menuZipCode : Menu = Menu.createMenu( null, _model.zipCodes, false ); menuZipCode.addEventListener( MenuEvent.ITEM_CLICK, zipCodeSelected ); menuZipCode.width = cityTextInput.width; menuZipCode.show( 258, 279 ); } else { var toastMessage : ImtToaster = new ImtToaster(); toastMessage.titleMessage = ResourceManager.getInstance().getString( 'labels', 'register.searchImpossibleTitle' ); toastMessage.message = ResourceManager.getInstance().getString( 'labels', 'register.searchImpossibleCity' ); toastMessage.level = ImtToaster.WARNING; ApplicationModelLocator.getInstance().toaster.toast( toastMessage ); } } private function zipCodeSelected( event : MenuEvent ) : void { zipCodeTextInput.text = event.item.toString(); } private function citySelected( event : MenuEvent ) : void { cityTextInput.text = event.item.toString(); } private function changeQuestion( event : ListEvent, comboBox : ComboBox ) : void { var newSelection : Object = ( event.currentTarget as ComboBox ).selectedItem; var otherListSelection : Object = comboBox.selectedItem; var index : int = 0; comboBox.dataProvider = ObjectUtil.copy( _model.questions ) as ArrayCollection; for( index = 0; index < comboBox.dataProvider.length; index++ ) { if( comboBox.dataProvider[ index ].code == newSelection.code ) { ( comboBox.dataProvider as ArrayCollection ).removeItemAt( index ); break; } } for( index = 0; index < comboBox.dataProvider.length; index++ ) { if( otherListSelection != null && comboBox.dataProvider[ index ].code == otherListSelection.code ) { comboBox.selectedIndex = index; break; } } } private function onChangeActivity( event : ListEvent ) : void { if( event.currentTarget.selectedItem.code == "S09" ) _otherActivityActive = true; else _otherActivityActive = false; } private function onTermsAndConditions() : void { _conditionsAreRead = true; /*if (_countrySelected == "") { var toastMessage : IMTToaster = new IMTToaster(); toastMessage.titleMessage = ResourceManager.getInstance().getString( 'labels', 'warning.use' ); toastMessage.message = ResourceManager.getInstance().getString( 'labels', 'register.noCountrySelected' ); toastMessage.level = IMTToaster.WARNING; ApplicationModelLocator.getInstance().toaster.toast( toastMessage ); } else*/ new TermsEvent(_model.connectedUser, ResourceManager.getInstance().getString('labels', 'lang'), this).dispatch(); } public function displayConditions( idterms : int, urlterms : String ) : void { _conditionsAreRead = true; _terms = new URLLoader(); _idTermsAccepted = idterms; _terms.addEventListener(Event.COMPLETE, onReadConditionsCompleteHandler); /*_terms.addEventListener(Event.OPEN, openHandler); _terms.addEventListener(ProgressEvent.PROGRESS, progressHandler); _terms.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); _terms.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler); _terms.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);*/ _terms.load(new URLRequest(urlterms)); } private function onReadConditionsCompleteHandler(event:Event) : void { var loader:URLLoader = URLLoader(event.target); var _applicationTermsPopUp : ApplicationTermsPopUp = new ApplicationTermsPopUp(); _applicationTermsPopUp.setTermsAndConditions(loader.data); PopUpManager.addPopUp( _applicationTermsPopUp, this, true ); PopUpManager.centerPopUp( _applicationTermsPopUp ); } private function onReadDatabase( event : Event) : void { var _applicationDatabaseTermsPopUp : ApplicationDatabaseTermsPopUp = new ApplicationDatabaseTermsPopUp(); PopUpManager.addPopUp( _applicationDatabaseTermsPopUp, this, true ); PopUpManager.centerPopUp( _applicationDatabaseTermsPopUp ); } // Affichage du fichier Pdf de la licence private function onReadLicence( event : Event) : void { if (licenceAgreeCheckBox.selected == true) { _conditionsAreRead = true; var req : URLRequest = new URLRequest("http://www.ipsocloud.com/151001IMT_CLOUDSoftware_License_Agreement.pdf"); navigateToURL( req, "_blank" ); } } private function checkTextInputEntry (textInputWithSkin : *, formItem : FormItem) : void { if (textInputWithSkin.errorString) { formItem.setStyle("color", "#7c0b13"); formItem.setStyle("fontWeight", "bold"); } else { formItem.setStyle("color", "#555557"); formItem.setStyle("fontWeight", "normal"); } } private function checkComboBoxEntry (comboBox : ComboBox, formItem : FormItem) : void { if (!comboBox.selectedItem) { formItem.setStyle("color", "#7c0b13"); formItem.setStyle("fontWeight", "bold"); } else { formItem.setStyle("color", "#555557"); formItem.setStyle("fontWeight", "normal"); } } private function onRegister( event : * ) : void { var toastMessage : ImtToaster = new ImtToaster(); var validatorsPartOne : Array = [ mailValidator, passwordValidator, confirmPasswordValidator, answerOneValidator, answerTwoValidator, questionOneValidator, questionTwoValidator ]; var validatorsPartTwo : Array = [ countryValidator, phoneCenterValidator, lastNameValidator, firstNameValidator, phoneValidator, activityValidator, cityValidator, zipCodeValidator, invoiceAddressValidator, shippingAddressValidator, hospitalValidator, frequencyValidator, brandValidator ]; var validatorsPartThree : Array = [ ]; var validators : Array = [ mailValidator, passwordValidator, confirmPasswordValidator, answerOneValidator, answerTwoValidator, questionOneValidator, questionTwoValidator, countryValidator, phoneCenterValidator, lastNameValidator, firstNameValidator, phoneValidator, activityValidator,cityValidator, zipCodeValidator, invoiceAddressValidator, shippingAddressValidator, hospitalValidator, frequencyValidator, brandValidator ]; if( _otherActivityActive ) { validatorsPartTwo.push( otherActivityValidator ); validators.push( otherActivityValidator ); } var validatorsError : Array = Validator.validateAll( validators ); var validatorsPartOneError : Array = Validator.validateAll( validatorsPartOne ); var validatorsPartTwoError : Array = Validator.validateAll( validatorsPartTwo ); var validatorsPartThreeError : Array = Validator.validateAll( validatorsPartThree ); _partOneValid = true; _partTwoValid = true; _partThreeValid = true; if( validatorsPartOneError.length != 0 ) partOne.enabled = true; else partOne.enabled = false; if( validatorsPartTwoError.length != 0 ) partTwo.enabled = true; else partTwo.enabled = false; if( validatorsPartThreeError.length != 0 ) partThree.enabled = true; else partThree.enabled = false; var textInputWithSkinList : Array = [ mailTextInput, passwordTextInput, confirmPasswordTextInput, answerOneTextInput, answerTwoTextInput, hospitalTextInput, invoiceAddressTextInput, shippingAddressTextInput, cityTextInput, zipCodeTextInput, phoneCenterTextInput, lastNameTextInput, firstNameTextInput, phoneTextInput, otherActivityTextInput, brandTextInput ]; var textInputLabel : Array = [ mailLabel, passwordLabel, confirmPasswordLabel, answerOneLabel, answerTwoLabel, hospitalLabel, invoiceAddressLabel, shippingAddressLabel, cityLabel, zipCodeLabel, phoneCenterLabel, lastNameLabel, firstNameLabel, phoneLabel, otherActivityLabel, brandLabel ]; var comboBoxList : Array = [ questionOneComboBox, questionTwoComboBox, countryComboBox, activityComboBox ]; var comboBoxLabel : Array = [ questionOneLabel, questionTwoLabel, countryLabel, activityLabel ]; for (var i : int = 0; i < textInputWithSkinList.length; i++) checkTextInputEntry(textInputWithSkinList[i], textInputLabel[i]); for (i = 0; i < comboBoxList.length; i++) checkComboBoxEntry(comboBoxList[i], comboBoxLabel[i]); if( validatorsError.length != 0 ) { toastMessage = new ImtToaster(); toastMessage.titleMessage = ResourceManager.getInstance().getString('labels', 'error.allFieldsTitle'); toastMessage.message = ResourceManager.getInstance().getString('labels', 'error.allFields'); toastMessage.timeToLive = 10; toastMessage.level = ImtToaster.WARNING; _model.toaster.toast( toastMessage ); } else if ((licenceAgreeCheckBox.selected == false) || (physicianAgreeCheckBox.selected == false)) { toastMessage = new ImtToaster(); toastMessage.titleMessage = ResourceManager.getInstance().getString('labels', 'error.allFieldsTitle'); toastMessage.message = ResourceManager.getInstance().getString('labels', 'error.checkAgreeUnchecked'); toastMessage.timeToLive = 10; toastMessage.level = ImtToaster.WARNING; _model.toaster.toast( toastMessage ); } else { if( !_conditionsAreRead ) { toastMessage = new ImtToaster(); toastMessage.titleMessage = ResourceManager.getInstance().getString('labels', 'termsOfUse'); toastMessage.message = ResourceManager.getInstance().getString('labels', 'error.conditionNotRead'); toastMessage.timeToLive = 7; toastMessage.level = ImtToaster.WARNING; _model.toaster.toast( toastMessage ); } else { /** * On enleve les caractère Espace, virgule, tiret, point * et on met la réponse en minuscule. */ FormatString.formatWithoutSpace( answerOneTextInput.text ); FormatString.formatWithoutSpace( answerTwoTextInput.text ); var newProbeVo : ProbeVo = new ProbeVo(); newProbeVo.frequency = frequencyNumericStepper.value var newUltraSoundScannerVo : UltraSoundScannerVo = new UltraSoundScannerVo(); newUltraSoundScannerVo.name = nameTextInput.text; newUltraSoundScannerVo.brand = brandTextInput.text; newUltraSoundScannerVo.type = typeTextInput.text; newUltraSoundScannerVo.age = new Date(ageNumericStepper.value); newUltraSoundScannerVo.probes.push( newProbeVo ); var newHospitalVo : HospitalVo = new HospitalVo(); newHospitalVo.name = hospitalTextInput.text; newHospitalVo.addressInvoicing = invoiceAddressTextInput.text; newHospitalVo.addressShipping = shippingAddressTextInput.text; newHospitalVo.city = cityTextInput.text; newHospitalVo.zipCode = zipCodeTextInput.text; newHospitalVo.country = countryComboBox.selectedItem.code; newHospitalVo.phone = phoneCenterTextInput.text; newHospitalVo.fax = faxCenterTextInput.text; var newPersonVo : PersonVo = new PersonVo(); newPersonVo.lastName = lastNameTextInput.text; newPersonVo.firstName = firstNameTextInput.text; newPersonVo.phone = phoneTextInput.text; newPersonVo.fax = faxTextInput.text; var newUserVo : UserVo = new UserVo(); newUserVo.hospital = newHospitalVo; newUserVo.help = true; newUserVo.ultraSoundScanner = newUltraSoundScannerVo; newUserVo.person = newPersonVo; newUserVo.login = mailTextInput.text; newUserVo.password = SHA256.hash( "INTim@meDia2011" + passwordTextInput.text ); newUserVo.questionOne = questionOneComboBox.selectedItem.code; newUserVo.answerOne = answerOneTextInput.text; newUserVo.questionTwo = questionTwoComboBox.selectedItem.code; newUserVo.answerTwo = answerTwoTextInput.text; newUserVo.buyer = buyer.selected; newUserVo.conditions = _idTermsAccepted; if ( activityComboBox.selectedItem.code == 9 ) newPersonVo.activity = otherActivityTextInput.text; else newPersonVo.activity = activityComboBox.selectedLabel; if ( dataBaseAgreeCheckBox.selected ) newUserVo.database = 1; else newUserVo.database = 0; registerButton.enabled = false; new RegisterEvent( newUserVo, ResourceManager.getInstance().getString('labels', 'language'), this ).dispatch(); } } } public function returnToHome(uid : String) : void { registerButton.enabled = true; clearRegisterForm(); this.parentDocument.selectedIndex = 0; var userVo : UserVo = new UserVo(); userVo.id = int(uid); } private function resetLabels() : void { var formItemList : Array = [ mailTextInput, passwordTextInput, confirmPasswordTextInput, answerOneTextInput, answerTwoTextInput, hospitalTextInput, invoiceAddressTextInput, shippingAddressTextInput, cityTextInput, zipCodeTextInput, questionOneComboBox, questionTwoComboBox, countryComboBox, phoneCenterTextInput, lastNameTextInput, firstNameTextInput, phoneTextInput, activityComboBox, otherActivityTextInput, brandTextInput ]; var formLabelList : Array = [ mailLabel, passwordLabel, confirmPasswordLabel, answerOneLabel, answerTwoLabel, hospitalLabel, invoiceAddressLabel, shippingAddressLabel, cityLabel, zipCodeLabel, questionOneLabel, questionTwoLabel, countryLabel, phoneCenterLabel, lastNameLabel, firstNameLabel, phoneLabel, activityLabel, otherActivityLabel, brandLabel ]; for (var i : int = 0; i < formItemList.length; i++) { formLabelList[i].setStyle("color", "#555557"); formLabelList[i].setStyle("fontWeight", "normal"); formItemList[i].errorString = ""; } } public function clearRegisterForm() : void { mailValidator.enabled = false; passwordValidator.enabled = false; confirmPasswordValidator.enabled = false; answerOneValidator.enabled = false; answerTwoValidator.enabled = false; hospitalValidator.enabled = false; invoiceAddressValidator.enabled = false; shippingAddressValidator.enabled = false; cityValidator.enabled = false; zipCodeValidator.enabled = false; questionOneValidator.enabled = false; questionTwoValidator.enabled = false; countryValidator.enabled = false; phoneCenterValidator.enabled = false; lastNameValidator.enabled = false; firstNameValidator.enabled = false; phoneValidator.enabled = false; activityValidator.enabled = false; brandValidator.enabled = false; frequencyValidator.enabled = false; otherActivityValidator.enabled = false; licenceAgreeValidator.enabled = false; physicianAgreeValidator.enabled = false; mailTextInput.text = ""; passwordTextInput.text = ""; confirmPasswordTextInput.text = ""; questionOneComboBox.selectedIndex = -1; questionOneComboBox.prompt = ResourceManager.getInstance().getString('labels', 'choose'); questionTwoComboBox.selectedIndex = -1; questionTwoComboBox.prompt = ResourceManager.getInstance().getString('labels', 'choose'); answerOneTextInput.text = ""; answerTwoTextInput.text = ""; hospitalTextInput.text = ""; invoiceAddressTextInput.text = ""; shippingAddressTextInput.text = ""; cityTextInput.text = ""; zipCodeTextInput.text = ""; countryComboBox.selectedIndex = -1; phoneCenterTextInput.text = ""; faxCenterTextInput.text = ""; lastNameTextInput.text = ""; firstNameTextInput.text = ""; phoneTextInput.text = ""; faxTextInput.text = ""; activityComboBox.selectedIndex = -1; activityComboBox.prompt = ResourceManager.getInstance().getString('labels', 'chooseActivity'); brandTextInput.text = ""; typeTextInput.text = ""; frequencyNumericStepper.value = 0; ageNumericStepper.value = 0; otherActivityTextInput.text = ""; licenceAgreeCheckBox.selected = false; dataBaseAgreeCheckBox.selected = false; physicianAgreeCheckBox.selected = false; mailValidator.enabled = true; passwordValidator.enabled = true; confirmPasswordValidator.enabled = true; answerOneValidator.enabled = true; answerTwoValidator.enabled = true; hospitalValidator.enabled = true; invoiceAddressValidator.enabled = true; shippingAddressValidator.enabled = true; cityValidator.enabled = true; zipCodeValidator.enabled = true; questionOneValidator.enabled = true; questionTwoValidator.enabled = true; countryValidator.enabled = true; phoneCenterValidator.enabled = true; lastNameValidator.enabled = true; firstNameValidator.enabled = true; phoneValidator.enabled = true; activityValidator.enabled = true; brandValidator.enabled = true; frequencyValidator.enabled = true; otherActivityValidator.enabled = true; licenceAgreeValidator.enabled = true; physicianAgreeValidator.enabled = true; resetLabels(); } private function setFieldError() : void { mailValidator.requiredFieldError = ResourceManager.getInstance().getString('labels', 'required'); mailValidator.invalidCharError = ResourceManager.getInstance().getString('labels', 'errorField'); mailValidator.invalidDomainError = ResourceManager.getInstance().getString('labels', 'errorField'); mailValidator.invalidIPDomainError = ResourceManager.getInstance().getString('labels', 'errorField'); mailValidator.invalidPeriodsInDomainError = ResourceManager.getInstance().getString('labels', 'errorField'); mailValidator.missingAtSignError = ResourceManager.getInstance().getString('labels', 'errorField'); mailValidator.missingPeriodInDomainError = ResourceManager.getInstance().getString('labels', 'errorField'); mailValidator.missingUsernameError = ResourceManager.getInstance().getString('labels', 'errorField'); mailValidator.tooManyAtSignsError = ResourceManager.getInstance().getString('labels', 'errorField'); passwordValidator.requiredFieldError = ResourceManager.getInstance().getString('labels', 'required'); confirmPasswordValidator.requiredFieldError = ResourceManager.getInstance().getString('labels', 'required'); answerOneValidator.requiredFieldError = ResourceManager.getInstance().getString('labels', 'required'); answerTwoValidator.requiredFieldError = ResourceManager.getInstance().getString('labels', 'required'); hospitalValidator.requiredFieldError = ResourceManager.getInstance().getString('labels', 'required'); invoiceAddressValidator.requiredFieldError = ResourceManager.getInstance().getString('labels', 'required'); shippingAddressValidator.requiredFieldError = ResourceManager.getInstance().getString('labels', 'required'); cityValidator.requiredFieldError = ResourceManager.getInstance().getString('labels', 'required'); zipCodeValidator.requiredFieldError = ResourceManager.getInstance().getString('labels', 'required'); questionOneValidator.requiredFieldError = ResourceManager.getInstance().getString('labels', 'required'); questionTwoValidator.requiredFieldError = ResourceManager.getInstance().getString('labels', 'required'); countryValidator.requiredFieldError = ResourceManager.getInstance().getString('labels', 'required'); phoneCenterValidator.requiredFieldError = ResourceManager.getInstance().getString('labels', 'required'); lastNameValidator.requiredFieldError = ResourceManager.getInstance().getString('labels', 'required'); firstNameValidator.requiredFieldError = ResourceManager.getInstance().getString('labels', 'required'); phoneValidator.requiredFieldError = ResourceManager.getInstance().getString('labels', 'required'); activityValidator.requiredFieldError = ResourceManager.getInstance().getString('labels', 'required'); brandValidator.requiredFieldError = ResourceManager.getInstance().getString('labels', 'required'); frequencyValidator.requiredFieldError = ResourceManager.getInstance().getString('labels', 'required'); otherActivityValidator.requiredFieldError = ResourceManager.getInstance().getString('labels', 'required'); licenceAgreeValidator.requiredFieldError = ResourceManager.getInstance().getString('labels', 'checkLicence'); physicianAgreeValidator.requiredFieldError = ResourceManager.getInstance().getString('labels', 'checkAgreePhysician'); } private function initListeners() : void { setFieldError(); mailValidator.addEventListener(ValidationResultEvent.VALID, mailValidatorHandler); passwordValidator.addEventListener(ValidationResultEvent.VALID, stringValidatorHandler); confirmPasswordValidator.addEventListener(ValidationResultEvent.VALID, stringValidatorHandler); answerOneValidator.addEventListener(ValidationResultEvent.VALID, stringValidatorHandler); answerTwoValidator.addEventListener(ValidationResultEvent.VALID, stringValidatorHandler); hospitalValidator.addEventListener(ValidationResultEvent.VALID, stringValidatorHandler); invoiceAddressValidator.addEventListener(ValidationResultEvent.VALID, stringValidatorHandler); shippingAddressValidator.addEventListener(ValidationResultEvent.VALID, stringValidatorHandler); cityValidator.addEventListener(ValidationResultEvent.VALID, stringValidatorHandler); zipCodeValidator.addEventListener(ValidationResultEvent.VALID, stringValidatorHandler); questionOneValidator.addEventListener(ValidationResultEvent.VALID, numberValidatorHandler); questionTwoValidator.addEventListener(ValidationResultEvent.VALID, numberValidatorHandler); countryValidator.addEventListener(ValidationResultEvent.VALID, numberValidatorHandler); phoneCenterValidator.addEventListener(ValidationResultEvent.VALID, stringValidatorHandler); lastNameValidator.addEventListener(ValidationResultEvent.VALID, stringValidatorHandler); firstNameValidator.addEventListener(ValidationResultEvent.VALID, stringValidatorHandler); phoneValidator.addEventListener(ValidationResultEvent.VALID, stringValidatorHandler); activityValidator.addEventListener(ValidationResultEvent.VALID, numberValidatorHandler); brandValidator.addEventListener(ValidationResultEvent.VALID, stringValidatorHandler); frequencyValidator.addEventListener(ValidationResultEvent.VALID, numberValidatorHandler); otherActivityValidator.addEventListener(ValidationResultEvent.VALID, stringValidatorHandler); licenceAgreeValidator.addEventListener(ValidationResultEvent.VALID, stringValidatorHandler); physicianAgreeValidator.addEventListener(ValidationResultEvent.VALID, stringValidatorHandler); } public function updateErrorStrings() : void { setFieldError(); if (mailTextInput.errorString) mailTextInput.errorString = ResourceManager.getInstance().getString('labels', 'errorField'); if (passwordTextInput.errorString) passwordTextInput.errorString = ResourceManager.getInstance().getString('labels', 'errorField'); if (confirmPasswordTextInput.errorString) confirmPasswordTextInput.errorString = ResourceManager.getInstance().getString('labels', 'errorField'); if (answerOneTextInput.errorString) answerOneTextInput.errorString = ResourceManager.getInstance().getString('labels', 'errorField'); if (answerTwoTextInput.errorString) answerTwoTextInput.errorString = ResourceManager.getInstance().getString('labels', 'errorField'); if (hospitalTextInput.errorString) hospitalTextInput.errorString = ResourceManager.getInstance().getString('labels', 'errorField'); if (invoiceAddressTextInput.errorString) invoiceAddressTextInput.errorString = ResourceManager.getInstance().getString('labels', 'errorField'); if (shippingAddressTextInput.errorString) shippingAddressTextInput.errorString = ResourceManager.getInstance().getString('labels', 'errorField'); if (cityTextInput.errorString) cityTextInput.errorString = ResourceManager.getInstance().getString('labels', 'errorField'); if (zipCodeTextInput.errorString) zipCodeTextInput.errorString = ResourceManager.getInstance().getString('labels', 'errorField'); if (questionOneComboBox.errorString) questionOneComboBox.errorString = ResourceManager.getInstance().getString('labels', 'errorField'); if (questionTwoComboBox.errorString) questionTwoComboBox.errorString = ResourceManager.getInstance().getString('labels', 'errorField'); if (countryComboBox.errorString) countryComboBox.errorString = ResourceManager.getInstance().getString('labels', 'errorField'); if (phoneCenterTextInput.errorString) phoneCenterTextInput.errorString = ResourceManager.getInstance().getString('labels', 'errorField'); if (lastNameTextInput.errorString) lastNameTextInput.errorString = ResourceManager.getInstance().getString('labels', 'errorField'); if (firstNameTextInput.errorString) firstNameTextInput.errorString = ResourceManager.getInstance().getString('labels', 'errorField'); if (phoneTextInput.errorString) phoneTextInput.errorString = ResourceManager.getInstance().getString('labels', 'errorField'); if (activityComboBox.errorString) activityComboBox.errorString = ResourceManager.getInstance().getString('labels', 'errorField'); if (otherActivityTextInput.errorString) otherActivityTextInput.errorString = ResourceManager.getInstance().getString('labels', 'errorField'); if (brandTextInput.errorString) brandTextInput.errorString = ResourceManager.getInstance().getString('labels', 'errorField'); if (frequencyNumericStepper.errorString) frequencyNumericStepper.errorString = ResourceManager.getInstance().getString('labels', 'errorField'); if (licenceAgreeCheckBox.errorString) licenceAgreeCheckBox.errorString = ResourceManager.getInstance().getString('labels', 'checkLicence'); if (physicianAgreeCheckBox.errorString) physicianAgreeCheckBox.errorString = ResourceManager.getInstance().getString('labels', 'checkAgreePhysician'); } private function mailValidatorHandler(event : ValidationResultEvent) : void { if (mailTextInput.errorString) mailTextInput.errorString = null; } private function stringValidatorHandler(event : ValidationResultEvent) : void { if (event.currentTarget.source.errorString) event.currentTarget.source.errorString = null; } private function numberValidatorHandler(event : ValidationResultEvent) : void { if (event.currentTarget.source.errorString) event.currentTarget.source.errorString = null; }