1 Reply Latest reply on May 24, 2007 11:53 AM by MotionMaker

    Problem with contact form..Please Helpl me!

      Hi!

      I have been using Flash since version 3 and in its version 8 I use to do a contact form using this code for the send button:
      Code:

      stop();
      String.prototype.isEmail = function() {
      var ref = arguments.callee;
      if(this.indexOf("@") == -1) return false;
      if(!isNaN(this.charAt(0))) return false;
      var email, user, domain, user_dots, domain_dots;
      if((email = this.split("@")).length == 2) {
      if((domain = email[1]).split(".").pop().length > 4) return false;
      if(domain.split(".").length < 2) return false;
      if((user = email[0]).indexOf(".") && domain.indexOf(".")) {
      if(user.length == 1 || domain.length == 1) return false;
      if(domain.lastIndexOf(".") > domain.length-3) return false;
      for(var c, t, i = (user_dots = user.split(".")).length; i--;) {
      c = user_dots ; t = !ref.$_text.call(c, "-", ".", "_");
      if(t || !isNaN(c)) return false;
      };
      for(var c, t, i = (domain_dots = domain.split(".")).length; i--;) {
      c = domain_dots
      ; t = !ref.$_text.call(c, "-", ".");
      if(t || !isNaN(c)) return false;
      };
      } else return false;
      } else return false;
      return true;
      };
      String.prototype.isEmail.$_punctuation = function() {
      if(this == "") return false;
      for(var i = arguments.length; i--;) {
      if(this.indexOf(arguments ) == 0) return false;
      if(this.indexOf(arguments
      ) == this.length-1) return false;
      };
      return true;
      };
      String.prototype.isEmail.$_text = function() {
      var ref = arguments.caller;
      if(!ref.$_punctuation.apply(this, arguments)) return false;
      var others = arguments; var checkOthers = function(str) {
      for(var i = others.length; i--;) if(str == others ) return true;
      return false;
      };
      for(var c, alpha, num, i = this.length; i--;) {
      c = this.charAt(i).toLowerCase();
      alpha = (c <= "z") && (c >= "a");
      num = (c <= "9") && (c >= "0");
      if(!alpha && !num && !checkOthers(c)) return false;
      };
      return true;
      };

      btSend.onRelease = function(){
      if(name.text == "" ) {
      status = "Type in your name.";
      Selection.setFocus("name");
      }else if (email.text ==""){
      status = "Type in your email."
      Selection.setFocus("email");
      }else if (msg.text == ""){
      status = "Type in your message."
      Selection.setFocus("msg");
      }else if(email.text.isEmail()){
      my_lv = new LoadVars();
      my_lv.name = name.text;
      my_lv.email = email.text;
      my_lv.msg = msg.text;
      my_lv.sendAndLoad('flashmailform.cfm', my_lv, 'POST');
      gotoAndPlay(5);
      }else{
      status = "Enter a valid Email";
      }
      }


      btClean.onRelease = function(){
      name.text = "";
      email.text = "";
      msg.text = "";
      Selection.setFocus("name");
      status = "";
      }

      Selection.setFocus("name");

      It worked just fine . you can see it at www.djchambinho.com but since i installed flash cs3 It just doesnt work.

      I have opened a new file with actionscript 2.0 but it doesnt work.

      When I click send button I have a message that I should enter a valid email address even if I enter a valid email address.And it doesnt tell me when I do not enter a name.

      what is wrong?

      thank you
      ecptavares is offline Reply With Quote