Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Contact Form Help

Options
  • 06-08-2018 3:11pm
    #1
    Registered Users Posts: 8,392 ✭✭✭


    Hi, anyone of you able to point me to where I might get a HTML ready to go Contact Form code? I don't code as such so am looking for something I could edit the basic details such as the email address etc and paste the code into the site.

    I've found a few on-line but they just didn't work.

    I eventually found one that works perfectly but unfortunately it is littered with link backs to the developers site, even the email it sends has link backs and it is just too in your face to use. A shame from my point of view as it works flawlessly, just overkill on the linkbacks.

    "Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid."



Comments

  • Registered Users Posts: 7,157 ✭✭✭srsly78


    First test if you can send mail normally from the system (echo whatever | mail joe@bloggs.com). Then do the web page bit.


  • Banned (with Prison Access) Posts: 1,480 ✭✭✭bloodless_coup


    If you don't code and have no backend, there's not much you can do with static HTML. Whats supposed to happen when they submit the form?

    Maybe you could use a service like https://formspree.io or create a form with survey monkey and embed it into your page.


  • Registered Users Posts: 403 ✭✭counterpointaud


    You can't send an email directly from a contact form on the client, you will need to send the data to a server somewhere first. Preferably on your own domain. If you don't have a server system to manage that you may be able to find a third-party service that you can send the form data to. Those type of services will typically give you the contact form markup to paste into your document. If you do go this route, do some research/due diligence on the service, as you are now passing data (incl. probably email addresses) from your site visitors to a third-party.


  • Registered Users Posts: 8,392 ✭✭✭Gadgetman496


    Firstly, I appreciate all who are attempting to help with this one :)

    srsly78 wrote: »
    First test if you can send mail normally from the system (echo whatever | mail joe@bloggs.com). Then do the web page bit.

    Thanks but no idea how to do that.

    I have a simple site that's hosted with a hosting company.

    doylefe wrote: »
    If you don't code and have no backend, there's not much you can do with static HTML. Whats supposed to happen when they submit the form?

    Maybe you could use a service like https://formspree.io or create a form with survey monkey and embed it into your page.

    Thanks, What I want to happen when the form is submitted it for it to email me on a designated email address with the details of the submission and the senders email address.

    You can't send an email directly from a contact form on the client, you will need to send the data to a server somewhere first. Preferably on your own domain. If you don't have a server system to manage that you may be able to find a third-party service that you can send the form data to. Those type of services will typically give you the contact form markup to paste into your document. If you do go this route, do some research/due diligence on the service, as you are now passing data (incl. probably email addresses) from your site visitors to a third-party.

    Thanks, when you say server is that the server of my hosting company?


    That formspree.io you sugested looks like it might do the trick for me. I have it working as a test now and was glad to see it had the option to let me tweak it to divert to my own thanks page instead of theirs, that was something I wanted. It has reCAPTCHA built in too which is a nice bonus.

    Their are two little nags about it and I'm wondering if it would take much to get it to fix one of them in the code they supply, the other I'd imagine is not controllable from my end.

    The Nags:

    1. As it is, it's not required to enter an email address, it will send even if the submitter leaves it blank. Can code be added to their code to make that mandatory?

    2. When the form is being submitted it displays the recipients email addy (mine) briefly in the address bar of the browser which I'm not sure is a good thing.

    "Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid."



  • Banned (with Prison Access) Posts: 1,480 ✭✭✭bloodless_coup


    Put a "required" attribute on the email input. Will work on the majority of modern browsers.

    Maybe set up a new generic mailbox if people seeing your email address is an issue.


  • Advertisement
  • Moderators, Recreation & Hobbies Moderators Posts: 11,356 Mod ✭✭✭✭igCorcaigh


    For point 2: try changing the method attribute of the form to POST.

    That should pass the parameters via the form body rather than the query string in the address bar.


  • Registered Users Posts: 8,392 ✭✭✭Gadgetman496


    igCorcaigh wrote: »
    For point 2: try changing the method attribute of the form to POST.

    That should pass the parameters via the form body rather than the query string in the address bar.

    It is set to POST but it's in the action (on the same line of code) that you have to specify the email address you want to use.

    "Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid."



  • Registered Users Posts: 8,392 ✭✭✭Gadgetman496


    doylefe wrote: »
    Put a "required" attribute on the email input. Will work on the majority of modern browsers.

    Maybe set up a new generic mailbox if people seeing your email address is an issue.

    That worked a treat, thanks ;)

    "Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid."



  • Registered Users Posts: 8,392 ✭✭✭Gadgetman496


    I have one final question regarding my Contact Form.

    I'm using a very simple form (Form 1 bellow) that works fine. However, (Form 2 bellow) has a nice feature I'd love to incorporate into Form 1 if possible?

    The feature is that Form 2 has code the includes the senders IP Address in the email I receive when someone contacts me.

    I'm guessing it's some sort of php code?

    Can any of you highlight the code I need to copy and paste from Form 2 to Form 1 in order to get this to work with Form 1?


    Form 1

    78d8ea60c9.JPG

    Form 1 Code:
    <form method="POST" action="https://formspree.io/YOUREMAILHERE"&gt;
    <input name="email" placeholder="Your email" type="email">
    <br><br>
    <textarea name="message" placeholder="Your message"></textarea>
    <button type="submit">Send</button>
    </form>



    Form 2

    02240accfc.JPG

    Form 2 code:
    <h2>Contact Us</h2>
    <form action="https://www.SnapHost.com/captcha/send.aspx&quot; id="ContactUsCaptchaWebForm" method="post" onsubmit="return ValidateForm(this);" target="_top">
    <input name="skip_WhereToSend" type="hidden" value="your@email.com" />
    <input name="skip_SnapHostID" type="hidden" value="9EQ3XLFCTLGN" />
    <input name="skip_WhereToReturn" type="hidden" value="http://www.YourWebsiteAddress.com/ThankYouPage.htm&quot; />
    <input name="skip_Subject" type="hidden" value="Contact Us Form" />
    <input name="skip_ShowUsersIp" type="hidden" value="1" />
    <input name="skip_SendCopyToUser" type="hidden" value="1" />
    <script type="text/javascript">
    function ValidateForm(frm) {
    if (frm.Name.value == "") {alert('Name is required.');frm.Name.focus();return false;}
    if (frm.FromEmailAddress.value == "") {alert('Email address is required.');frm.FromEmailAddress.focus();return false;}
    if (frm.FromEmailAddress.value.indexOf("@) < 1 || frm.FromEmailAddress.value.indexOf(.") < 1) {alert('Please enter a valid email address.');frm.FromEmailAddress.focus();return false;}
    if (frm.Comments.value == "") {alert('Please enter comments or questions.');frm.Comments.focus();return false;}
    if (frm.skip_CaptchaCode.value == "") {alert('Enter web form code.');frm.skip_CaptchaCode.focus();return false;}
    return true; }
    function ReloadCaptchaImage(captchaImageId) {
    var obj = document.getElementById(captchaImageId);
    var src = '' + obj.src;
    obj.src = '';
    var date = new Date();
    var pos = src.indexOf('&rad=');
    if (pos >= 0) { src = src.substr(0, pos); }
    obj.src = src + '&rad=' + date.getTime();
    return false; }
    </script>
    <table border="0" cellpadding="5" cellspacing="0" width="600">
    <tr>
    <td><b>Name*:</b></td>
    <td><input name="Name" type="text" maxlength="60" style="width:350px;" /></td>
    </tr><tr>
    <td><b>Phone number:</b></td>
    <td><input name="PhoneNumber" type="text" maxlength="43" style="width:350px;" /></td>
    </tr><tr>
    <td><b>Email address*:</b></td>
    <td><input name="FromEmailAddress" type="text" maxlength="60" style="width:350px;" /></td>
    </tr><tr>
    <td><b>Comments and questions*:</b></td>
    <td><textarea name="Comments" rows="7" cols="40" style="width:350px;"></textarea></td>
    </tr><tr>
    <td colspan="2" align="center"> <br />
    <table border="0" cellpadding="0" cellspacing="0">
    <tr><td colspan="2" style="padding-bottom:18px;">
    <!-- Please check our ProCaptcha service which is ad-free:
    https://www.SnapHost.com/captcha/ProCaptchaOverview.aspx -->
    <a href="http://www.snaphost.com/captcha/ReadyForms/SignUpForm.aspx&quot; alt="registration form online" title="registration form online">
    registration form online</a></td></tr>
    <tr valign="top"><td> <i>Enter web form code*:</i>
    <input name="skip_CaptchaCode" type="text" style="width:80px;" maxlength="6" />
    </td><td>
    <a href="https://www.snaphost.com/captcha/ReadyForms/ContactUsForm.aspx"><img id="CaptchaImage" alt="Contact Us form" title="HTML code for Contact Us form"
    style="margin-left:20px;"
    src="https://www.SnapHost.com/captcha/CaptchaImage.aspx?id=9EQ3XLFCTLGN&ImgType=2&quot; /></a><br />
    <a href="#" onclick="return ReloadCaptchaImage('CaptchaImage');"><span style="font-size:12px;">reload image</span></a> </td></tr>
    </table> <br />
    * - required fields.              
    <input name="skip_Submit" type="submit" value="Submit" />
    </td></tr>
    </table><br />
    </form>

    "Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid."



  • Closed Accounts Posts: 9,700 ✭✭✭tricky D


    This bit is the bit that captures the IP... <input name="skip_ShowUsersIp" type="hidden" value="1" />

    However that only works in the second form as it uses a different 'sending program'; the form action bit, so you can't just grab a bit from one form method and pop it into another and expect it to work.


  • Advertisement
  • Registered Users Posts: 8,392 ✭✭✭Gadgetman496


    tricky D wrote: »
    This bit is the bit that captures the IP... <input name="skip_ShowUsersIp" type="hidden" value="1" />

    However that only works in the second form as it uses a different 'sending program'; the form action bit, so you can't just grab a bit from one form method and pop it into another and expect it to work.

    OK, forget the IP capture for now.

    Right now I'm relying on a 3rd party service (formspree.io) to handle the email sending of the data input to my contact form.

    So if I wanted to have a contact form that the data could be captured and the email sent from my hosting account server instead of relying on a 3rd party service, is that possible?

    If it is possible? am I correct in my understanding I'd need the following files uploaded to my domain on my hosting account?

    contact Form.html (The actual Form displayed on my site)

    contact-form-handler.php (The bit that does the email sending)

    validator.js (A JavaScript validation script of some sort)

    Thanks.html (The Thanks page displayed to the submitter when a contact is sent)

    "Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid."



  • Registered Users Posts: 8,392 ✭✭✭Gadgetman496


    All of the standalone contact forms I've tried work up to the point the 'Submit' button is clicked but they all return the following error.
    The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used.

    What could be causing that?

    "Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid."



Advertisement