4 Replies Latest reply on Apr 18, 2006 4:28 PM by ntsiii

    Problem in defining next stage

    Digital_Hand
      Hi all,

      I provide a simple login screen to the user, the username and password will be sent to Java that will deal with MySQL

      The code above works fine, But I want now once the user successfully login to disable the Login Panel from him.
      I have tried to do the following thing:

      <mx:TextArea id="accessText" text="{access}" editable="false" enabled="false" height="20" borderColor="#FFFFFF" change="checkAccess(user.text)" />

      But it doesnot work, the text change but it did not brodcast the change event. You could see here that checkAccess method
      is the one who reponsible about hiding the Login Panel

      How can I do that.
      I posted another question about Validator, I hope if you can help me in both of them

      Validator question URL: http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?catid=346&threadid=11432 87&enterthread=y

      I am using Flex v1.5

      Thanks
        • 1. Re: Problem in defining next stage
          ntsiii Level 3
          I believe the change event is only fired when a user changes the value, and not when the value is changed programmatically, as with the binding.

          You want to use the "valueCommitted" event. From the docs:
          valueCommitted
          Broadcast when values are changed programmatically. The event object's target property contains a reference to the component that triggered the event. The event object's type property contains the name of the event, valueCommitted.

          Tracy
          • 2. Re: Problem in defining next stage
            Digital_Hand Level 1
            Hi ntsiii,

            thanks for quick reply

            Now its work fine.

            Can you help also in the following link
            http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?catid=346&threadid=11432 87&enterthread=y

            Thanks a lot again
            • 3. Re: Problem in defining next stage
              Digital_Hand Level 1
              Its seem like in a hurry to find the solution.

              1. Now I can send the login information (username and password) after the validate process to make sure that the user entered both of them.

              2. The data will be sent to userLogin(String n, String p){...} method in Java which will be responsible about the MySQL connection
              to verify the user login.

              3. At this point, I want to enable some panel which was disabled from the beginning once the step 2 verify that the user has the authority to access the application.

              Here is my code as well:

              For the login button::

              <mx:HBox><mx:Button label="OK" click="checkValidity();" /><mx:Button label="Cancel" /></mx:HBox>

              checkValidity method::

              function checkValidity():Void
              {
              var temp;
              temp= mx.validators.Validator.isStructureValid(this,'CheckModel');
              if (temp == true)
              {
              srv2.userLogin(username.text,password.text);
              if(srv2 == true) checkAccess() ;
              }
              //mx.controls.Alert.show(" The Information Entered is Valid!!", "Validity Check Box", Alert.OK);
              }

              checkAccess Method::

              private function checkAccess():Void
              {
              if( access != null )
              {
              accessText.text = access;
              settingsList.visible = true;
              }
              }

              Note:: srv2 will return null if the passed data does not match that one in MySQL Database.

              I hope if anyone can help me as sson as possible.

              Thanks in advance
              • 4. Re: Problem in defining next stage
                ntsiii Level 3
                If I understand your code correctly, srv2 is a RemoteObject, and you are trying to read the result in the line immediately after you call the method. Is that correct? If so, that will NOT work.

                Tracy