0 Replies Latest reply on Aug 24, 2006 8:41 PM by rein2

    email form sendandload HELP

    rein2
      i have been trying to get this to work for hours, but cannot get a "success"

      on (press) {
      validfields = "0";
      validemail = "0";
      if(!_root.contact.theform.input1.text.length || !_root.contact.theform.input2.text.length || !_root.contact.theform.input3.text.length)
      {_root.contact.theform.response.text = "Please complete all fields"}
      else{validfields = "10";}

      if(_root.contact.theform.input2.text.length && (_root.contact.theform.input2.text.indexOf ("@") == -1 || _root.contact.theform.input2.text.indexOf(".") == -1))
      {_root.contact.theform.response.text = "Please enter a valid email"}
      else{validemail = "10"}
      }

      on (release) {
      if (Number(validfields) == 10 and Number(validemail) == 10){
      my_lv = new LoadVars();
      my_lv.zname = _root.contact.theform.input1.text;
      my_lv.zcomments = _root.contact.theform.input3.text;
      my_lv.zaddress = _root.contact.theform.input2.text;
      my_lv.sendandload(" http://localhost/pointresidential/email.cfm", my_lv, "POST");
      trace("here")
      trace(this);
      trace(my_lv.zname);
      trace(my_lv.zaddress);
      trace(my_lv.zcomments);
      my_lv.onload = function(success:Boolean)
      {
      if(success)
      {trace("success");
      _root.contact.theform.response.text = my_lv.welcomeMessage;}

      else
      {trace("failure")
      _root.contact.theform.response.text = "fail"}
      }}
      }


      Coldfusion code:

      <cfsetting enablecfoutputonly="Yes">
      <cfif IsDefined("URL.zname")><cfset Form.zName = URL.zname />
      <cfset Form.zaddress = URL.zaddress /><cfset Form.zcomments = URL.zcomments />
      </cfif>
      <cfmail to="aangulo@vt.edu" from = "#form.zaddress#" subject="Customer Inquiry">
      Name: #form.zname#
      Questions/Comments: #form.zcomments#
      </cfmail>
      <cfif NOT IsDefined("Form.zname") OR Len(Trim(Form.zName)) EQ 0>
      <cfset Form.zName = "[Mysterious Stranger]" />
      </cfif>
      <cfoutput>welcomeMessage=#UrlEncodedFormat("Welcome, "&Form.zname)#</cfoutput>
      <cfsetting enablecfoutputonly="No">