1 Reply Latest reply on Mar 2, 2007 4:21 PM by tspratt

    Error Message Returning Custom Error

    kiamber
      I've got a login form that checks against the login.cfc. What I'm trying to figure out is how to return a Custom Error message. This is what I have so far:

      private function receiveValidationEmail(event:ResultEvent):void {
      clearLoginForm();
      if (userMessage == "Success"){
      Alert.show("Your Login Information has been sent");
      }else{
      Alert.show(userMessage);
      }
      }

      private function sendCheckEmail():void {
      if (txtEmail.text != '' && txtLoginId.text != '' || txtPassword.text != '') {
      daLoginScreen.validateEmail(txtLoginId.text,txtPassword.text,txtEmail.text);
      currentState='';
      }
      }

      <mx:method name="validateEmail" result="receiveValidationEmail(event)">

      If the user forgets any info they will call the sendCheckEmail function:
      <mx:LinkButton label="Email Login Information?" click="currentState='Login';sendCheckEmail()"/>

      Then within the login.cfc:
      <cffunction name="validateEmail" output="false" access="public" returntype="userMessage ">

      run the query....

      <cfif query.UserEmail EQ 0>
      <cfset userMessage = 'Email'>

      </cfif>

      <cfif query.LoginId EQ 0>
      <cfset userMessage = 'Login'>
      </cfif>

      <cfif query.Password EQ 0>
      <cfset userMessage = 'Password'>
      </cfif>

      <cfif query.Recordcount GT 0>
      <cfset userMessage = "Success">
      </cfif>

      <cfreturn userMessage>

      I'm not getting Flex to pass back any "userMessage"..... Is there any example of how to send this message back to the Flex application within a "Form" element? Thank you in advance for your prompt response!