5 Replies Latest reply on Jul 18, 2008 11:10 AM by Gregory Lafrance

    Validation error display

    srib
      Dear All,

      I want to display the validation error message when user clicks on Submit.
      I general when you lost the focus from the text box then validation occurs.( focusLost).
      And again when you roll over your mouse on the text box then the error message gets displays. Instead of that is it possible to display the message when you click on submit buttons instead of Mouse Over.


      and the following is my code.

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
      <mx:Script>
      <![CDATA[
      import mx.events.ValidationResultEvent;
      private var valiResult:ValidationResultEvent;

      private function errorDisplay()
      {
      valiResult = phoneValidator.validate()
      if(valiResult.type == ValidationResultEvent.VALID)
      {
      // Perform some Action
      }else
      {
      // Display error message here.
      }
      }
      ]]>
      </mx:Script>
      <mx:TextInput x="411" y="182" id="phoneTxt"/>
      <mx:TextInput x="411" y="212"/>
      <mx:Button x="411" y="255" label="Submit"/>
      <mx:NumberValidator id="phoneValidator" source="{phoneTxt}" property="text"/>
      </mx:Application> // Display error message here.