Announcement

Collapse
No announcement yet.

How to Add Captcha to from

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to Add Captcha to from

    I am trying to replace the contact page on 3dcart with a plain contact form.
    Can anyone help with adding the captcha to the form below?
    I have tried several times, and end up giving up each time. Support is no help.
    Thank you.

    Code:
    <div align="center">
    <table><tr><td class="content" style="text-align: Center"><p>&nbsp;</p>
    Need help?&nbsp; If you Have questions or comments?&nbsp;  please fill out the form below, and then click submit.&nbsp; 
    <br>
    <br>
    We 
    		try to respond to most requests within 24hrs excluding Sundays and 
    		Holidays.<p>For returns please use the <a href="returns.html">Returns
    		</a>form.<br>
    </td></tr></table>
    <form action="aspsendmail.asp" method="post" onSubmit="return checkrequired(this)">
    <span class="style1">
    <input type="hidden" value="Customer Comments from." name="_subject">
    <input value="[email protected]" name="_recipients" type="hidden">
    <input type="hidden" value="thankyou.html" name="_redirect">
      </span>
      <table border="0" cellpadding="1" cellspacing="1" width="507">
        <tr>
          <td colspan="4" class="style1">
    		<br>
    		Required info is marked with ( <font color="#800080">* </font>)<br>
    		<br /></td>
        </tr>
        <tr valign="top">
          <td class="style1">First Name</td>
          <td class="style1" colspan="3"><input type="text" name="required-First-Name" value="" size="30" maxlength="">&nbsp; 
    		*</td>
        </tr>
        <tr valign="top">
          <td class="style1">Last Name</td>
          <td class="style1" colspan="3"><input type="text" name="required-Last-Name" value="" size="30" maxlength="">
    		<font color="#800080">&nbsp;*</font></td>
        </tr>
        <tr valign="top">
          <td><span size="6" class="style1">Company Name</span></td>
          <td class="style1" colspan="3"><input type="text" name="Company Name" value="" size="30" maxlength=""></td>
        </tr>
        <tr valign="top">
          <td class="style1" width="150">Home Phone Number</td>
          <td class="style1" colspan="3" width="350"><input type="text" name="Home-Phone" value="" size="30" maxlength=""></td>
        </tr>
        <tr valign="top">
          <td class="style1">Work Phone Number</td>
          <td class="style1" colspan="3"><input type="text" name="Work-Phone" value="" size="30" maxlength=""></td>
        </tr>
        <tr valign="top">
          <td class="style1">Address 1</td>
          <td class="style1" colspan="3"><input type="text" name="Address1" value="" size="30" maxlength=""></td>
        </tr>
            </tr>
        <tr valign="top">
          <td class="style1">Address 2</td>
          <td class="style1" colspan="3"><input type="text" name="Address2" value="" size="30" maxlength=""></td>
        </tr>
            </tr>
        <tr valign="top">
          <td class="style1">City</td>
          <td class="style1" colspan="3"><input type="text" name="City" value="" size="30" maxlength=""></td>
      </tr> 
           <tr valign="top">
           <td class="style1">State</td>
          <td class="style1" width="81"><input type="text" name="State" value="" size="2" maxlength=""></td>
          <td class="style1" style="width:89px">Zip Code</td>
          <td class="style1" width="190"><input type="text" name="Zip" value="" size="5" maxlength=""></td>           
        </tr>
           <tr valign="top">
          <td class="style1">Country</td>
          <td class="style1" colspan="3"><input type="text" name="Country" value="" size="30" maxlength=""></td>
        </tr>
        
        <tr valign="top">
          <td class="style1">E-mail Address</td>
          <td class="style1" colspan="3"><input type="text" name="required-E-Mail" value="" size="30" maxlength="">
    		<font color="#800080">&nbsp;*</font></td>
        </tr>
        <tr valign="top">
         <td class="style1">Confirm E-mail</td>
        <td class="style1" colspan="3"><input type="text" name="required-Confirm_E-Mail" value="" size="30" maxlength="">
    	<font color="#800080">&nbsp;*</font></td>
        </tr>
        
        <tr>
          <td><br>How Found Site?</td><td  colspan="3"><br>
            <select name="required-How_Found_Site">
              <option selected>Pick an option!
              <option>Word of Mouth</option>
              <option>Repeat Customer</option>
              <option>Google</option>
              <option>Yahoo</option>
              <option>Bing</option>
              <option>The Find</option>
              <option>Other</option>
            </select>&nbsp;
          <font color="#800080">*</font></td>
        </tr>
        
        <tr valign="top">
          <td class="style1"><br>Subject</td>
          <td class="style1" colspan="3"><br><input type="text" name="required-Subject" value="" size="30" maxlength="">
    		<font color="#800080">&nbsp;*</font></td>
        </tr>
        <tr valign="top">
          <td  colspan="4" style="height: 135px" class="style1"><br>
    		Message:&nbsp;
    		<font color="#800080">*</font><br>
    		<br />
            <textarea name="required-Message" cols="50" wrap="soft" style="height: 128px" class="style1"></textarea></td>
        </tr>
        <tr valign="top">
          <td colspan="4"><span class="style1"><input type="submit" name="" value="Submit"></span>
    		<span class="style1">
            <input type="reset" name="" value="Clear"></span></td>
        </tr>
      </table>
    </form>
    </div>
    Last edited by elightbox; 05-24-2011, 05:28 PM.

  • #2
    You got it

    You needed a hole lot more then the captcha added.
    • There was no validation on the required fields
    • No text wrap tag
    • no fields tab set

    Added a few extras

    Code:
    			<script>
    		var addReplyClick = 0;
    		
    	    function submitForm(strAction)
    	    {
    	        document.frmForm.action.value = strAction;
    	        document.frmForm.submit();
    	    }
    	    function addNew()
    	    {
    			var strMsg = "";
    			if (document.frmForm.first_name.value.trim() == "")
    				strMsg += " - First Name cannot be blank.\n";
    			if (document.frmForm.Last_Name.value.trim() == "")
    				strMsg += " - Last Name cannot be blank.\n";
    			if (document.frmForm.Email.value.trim() == "" || !isValidEmail(document.frmForm.Email.value))
    				strMsg += " - Email cannot be blank and must be a valid email address.\n";
    			if (document.frmForm.subject.value.trim() == "")
    				strMsg += " - Subject cannot be blank.\n";
    			if (document.frmForm.Message.value.trim() == "")
    				strMsg += " - Message cannot be blank.\n";
    			<!--START: captchascript-->
    			if (document.frmForm.ramdomWord.value.trim() == "")
    				strMsg += " - Verification word cannot be blank.\n";			
    			<!--END: captchascript-->
    				
    			if (strMsg != ""){
    				alert(strMsg);
    				return false;
    			}
    			if (addReplyClick == 0){
    				addReplyClick = 1;
    				submitForm('addnew');
    			}
    
    	    }
    		String.prototype.trim = function() {
    			return this.replace(/^\s+|\s+$/g,"");
    		}
    		function isValidEmail(str) {
    
    			var at="@"
    			var dot="."
    			var lat=str.indexOf(at)
    			var lstr=str.length
    			var ldot=str.indexOf(dot)
    			
    			if (str.indexOf(at)==-1)
    			   return false
    
    			if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
    			   return false
    
    			if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
    			    return false
    		
    			 if (str.indexOf(at,(lat+1))!=-1)
    			    return false
    
    			 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
    			    return false
    
    			 if (str.indexOf(dot,(lat+2))==-1)
    			    return false
    			
    			 if (str.indexOf(" ")!=-1)
    			    return false
    
    	 		 return true					
    		}    
    	</script>
    	
    		<div align="center">
    			<table>
    				<tr>
    					<td class="content" style="text-align: Center">
    						<p>&nbsp;
    Need help?&nbsp; If you Have questions or comments?&nbsp;  please fill out the form below, and then click submit.&nbsp; <br>
    						</p>
    						<p>
    							
    We 
    		try to respond to most requests within 24hrs excluding Sundays and 
    		Holidays.</p>
    						<p>For returns please use the <a href="returns.html">Returns
    </a>form.<br>
    							<br>
    						
    					</td>
    				</tr>
    			</table>
    		</div>
    		<table width="95%" cellpadding="0" cellspacing="0">
    			<!--START: CATEGORY_HEADER--><!--END: CATEGORY_HEADER-->
    			<tr>
       <td colspan="2">
    					<form method="post" action="aspsendmail.asp" id="frmForm" name="frmForm">
    						<div align="center">
    							<input type="hidden" name="action" id="action" value=""> <input type="hidden" value="Customer Comments from." name="_subject"> <input value="[email protected]" name="_recipients" type="hidden"> <input type="hidden" value="thankyou.html" name="_redirect">
    							<table border="0" class="alternative" cellpadding="4" cellspacing="0">
    								<tr>
    									<td style="width: 80px" class="item" colspan="2"></td>
    								</tr>
    								<tr>
    									<td style="width: 80px" class="item" nowrap>First Name:</td>
    									<td><input type="text" name="first_name" value=""  size="50" maxlength="50" class="txtBoxStyle" tabindex="1"> <img src="assets/templates/common/images/error2.gif" width="12" height="12"></td>
    								</tr>
    								<tr>
    									<td style="width: 80px" class="item" nowrap>Last Name:</td>
    									<td><input type="text" name="Last_Name" size="50" maxlength="50" class="txtBoxStyle" tabindex="2"> <img src="assets/templates/common/images/error2.gif" width="12" height="12"></td>
    								</tr>
    								<tr>
    									<td style="width: 80px" class="item" nowrap>Company Name:</td>
    									<td><input type="text" name="Company Name" value=""  size="50" maxlength="50" class="txtBoxStyle" tabindex="3"></td>
    								</tr>
    								<tr>
    									<td style="width: 80px" class="item" nowrap>Home Phone:</td>
    									<td><input type="text" name="Home Phone" value=""  size="20" maxlength="50" class="txtBoxStyle" tabindex="4"></td>
    								</tr>
    								<tr>
    									<td style="width: 80px" class="item" nowrap>Work Phone:</td>
    									<td><input type="text" name="Work Phone" value=""  size="20" maxlength="50" class="txtBoxStyle" tabindex="5"></td>
    								</tr>
    								<tr>
    									<td style="width: 80px" class="item" nowrap>Address 1:</td>
    									<td><input type="text" name="Address 1" value=""  size="50" maxlength="50" class="txtBoxStyle" tabindex="6"></td>
                                                            </tr>
                                                            <tr>
    									<td style="width: 80px" class="item" nowrap>Address 2:</td>
    									<td><input type="text" name="Address 2" value=""  size="50" maxlength="50" class="txtBoxStyle" tabindex="7"></td>
    								</tr>
    								<tr>
    									<td style="width: 80px" class="item" nowrap>City:</td>
    									<td><input type="text" name="City" value=""  size="30" maxlength="50" class="txtBoxStyle" tabindex="8"></td>
    								</tr>
    								<tr>
    									<td style="width: 80px" class="item" nowrap>State:</td>
    									<td><input type="text" name="State" value=""  size="30" maxlength="50" class="txtBoxStyle" tabindex="9"></td>
    								</tr>
    								<tr>
    									<td style="width: 80px" class="item" nowrap>Zip Code:</td>
    									<td><input type="text" name="Zip Code" value=""  size="10" maxlength="20" class="txtBoxStyle" tabindex="10"></td>
    								</tr>
    								<tr>
    									<td style="width: 80px" class="item" nowrap>Country:</td>
    									<td><input type="text" name="Country" value=""  size="30" maxlength="50" class="txtBoxStyle" tabindex="11"></td>
    								</tr>
    								<tr>
    									<td style="width: 80px" class="item" nowrap>Email:</td>
    									<td><input type="text" name="Email" value=""  size="50" maxlength="50" class="txtBoxStyle" tabindex="21"> <img src="assets/templates/common/images/error2.gif" width="12" height="12"></td>
    								</tr>
    								<tr>
    									<td style="width: 80px" class="item" nowrap>How Found Site?</td>
    									<td><select name="How Found Site" size="1" tabindex="13">
    											<option selected value="-">Pick an option!</option>
    											<option value="Word of Mouth">Word of Mouth</option>
    											<option value="Repeat Customer">Repeat Customer</option>
    											<option value="Google">Google</option>
    											<option value="Yahoo">Yahoo</option>
    											<option value="Bing">Bing</option>
    											<option value="The Find">The Find</option>
    											<option value="Other">Other</option>
    										</select></td>
    								</tr>
    								<tr>
    									<td style="width: 80px" class="item" nowrap><br>
    									</td>
    									<td></td>
    								</tr>
    								<tr>
    									<td style="width: 80px" class="item" nowrap>Subject:</td>
    									<td><input name="subject" type="text" id="subject" value="" size="50" maxlength="150" class="txtBoxStyle" tabindex="14"> <img src="assets/templates/common/images/error2.gif" width="12" height="12"></td>
    								</tr>
    								<tr>
    									<td style="width: 80px" class="item" nowrap>Message:</td>
    									<td><textarea name="Message" id="reply" style="width: 300px; height: 58px" class="txtBoxStyle" tabindex="15"></textarea> <img src="assets/templates/common/images/error2.gif" width="12" height="12"></td>
    								</tr>
    								<!--START: captcha-->
    								<tr>
    									<td style="width: 80px" class="item" nowrap><br>
    									</td>
    									<td></td>
    								</tr>
    								<tr>
    									<td style="width: 80px" class="item" nowrap>Verification:</td>
    									<td class="item" nowrap><img src="admin/image_pw.asp" border="0" width="148"><br>
    										
    									Type the word above...<br>
    										<input type="text" name="ramdomWord" id="ramdomWord" autocomplete="off" value="" size="25" maxlength="30" class="txtBoxStyle" tabindex="16"> <img src="assets/templates/common/images/error2.gif" width="12" height="12"></td>
    								</tr>
    								<!--END: captcha-->
    								<tr>
    									<td colspan="2" nowrap>
    										<div align="center">
    											<br>
    											<input type="button" onclick="javascript:addNew();" class="btn" onmouseover="this.className='btn_over'" onmouseout="this.className='btn'" value="Submit" tabindex="17"> <input type="reset" class="btn" onmouseover="this.className='btn_over'" onmouseout="this.className='btn'" value="Clear"></div>
    									</td>
    								</tr>
    							</table>
    							<p></p>
    						</div>
    					</form>
    </table>
    This was my first time building a form for this platform. I thought I read awhile back that ?action=contactus was needed. Oh well works just fine.

    Enjoy!
    .
    Clayton
    Go Live Industries

    Comment


    • #3
      Go Live, Thank you for taking the time to work on this contact form. Much appreciated.

      However:
      the form still submits and goes to the Thank You page with any text in the captcha box.

      and I don't think these two lines are supposed to be in the message received.

      The first line in the message received is: action: addnew
      The last line in the message received is: ramdomWord: 555
      (the 555 is the text I entered in the Captcha box)

      Comment


      • #4
        Just checked and the captcha is validated when submited to
        crm.asp?action=contactus
        You are sending the form to
        aspsendmail.asp

        At this point you can make a required field that matches your choice of characters and set your own image.
        Or download one of the many captcha scripts. To bad we don't have access to the CGI-bin.

        As for the extra elements I was just getting the form to validate on the page level. Not cleanup the form from other functions, that would be a bit much for charity.

        Enjoy!
        .
        Clayton
        Go Live Industries

        Comment


        • #5
          Thank you for the attempt. getting too complicated for my modest abilities. decided to go with an outside form even though I do not like depending on an outside site.
          Used JotForm · Easiest Form Builder Seems great so far, and it is free.

          Comment


          • #6
            Many use jotform

            Personally I don't like to share my customer emails with free 3rd parties.
            .
            Clayton
            Go Live Industries

            Comment


            • #7
              Originally posted by Go Live View Post
              Personally I don't like to share my customer emails with free 3rd parties.
              They are an established company and they have a clear privacy policy
              "Is my form submission data safe? Yes, your data belongs to you. We do not share or sell any user data. We also do not access your data for any non-administrative purposes. "

              We all depend on 3rd parties, including 3dcart. We have to do our due diligence, but I am sure you also trust some others whomever they may be with your data.

              Comment


              • #8
                Originally posted by elightbox View Post
                Thank you for the attempt. getting too complicated for my modest abilities. decided to go with an outside form even though I do not like depending on an outside site.
                Used JotForm · Easiest Form Builder Seems great so far, and it is free.
                I also scraped (disabled) the 3dcart email sysyem as I did not like to have to log into me 3dcart admin to reply to an email. There is probably away around that part but I still wanted my own customize form that I use that I do pay for but it allows me to be able to upload images which I wanted to have customers be able to do.
                Jan
                Blu's Bird Toys

                Comment

                Working...
                X