topical media & game development

talk show tell print

mashup-rmx-08-RMXFormExample-com-almerblank-rmx-forms-NewMemberForm.ax

mashup-rmx-08-RMXFormExample-com-almerblank-rmx-forms-NewMemberForm.ax (swf ) [ flash ] flex


  package com.almerblank.rmx.forms
  {
          import com.almerblank.rmx.dto.Member;
          import com.almerblank.rmx.utils.RMXGateway;
          
          import mx.containers.Form;
          import mx.controls.Alert;
          import mx.rpc.events.ResultEvent;
          import mx.validators.Validator;
  
          public class NewMemberForm extends Form
          {
                  [Bindable]
                  public var memberInfo:Member = new Member();
                  
                  [Bindable]
                  public var validators:Array;
                  
                  public function NewMemberForm()
                  {
                          super();
                  }
                  
                  public function validateForm():void
                  {
                          var validationResults:Array = Validator.validateAll(this.validators);
                          
                          if (validationResults.length == 0)
                          {
                                  // form is valid
                                  //RMXGateway.call(RMXGateway.ADD_NEW_MEMBER, onSuccess, RMXGateway.onFault, this.memberInfo);
                                  Alert.show("The form is valid");
                          }
                          else
                          {
                                  Alert.show("The form still contains invalid fields, please fill out the form completely and make sure none of the fields glow red.", "Invalid Fields");
                          }
                  }
                  
                  private function onSuccess( event:ResultEvent ):void
                  {
                          Alert.show('success');
                  }
                  
          }
  }


(C) Æliens 18/6/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.