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 - how to disable need for email address

Options
  • 14-01-2013 6:13pm
    #1
    Closed Accounts Posts: 89 ✭✭


    Hi,
    I've just installed a simple contact form, its the one found here http://www.html-form-guide.com/contact-form/simple-php-contact-form.html

    I'm not sure if this is even possible, but I want to disable the need for the person making contacting to have to supply their email address. I'll have to do this in the php file I presume.

    My knowledge of coding and all that is pretty basic (I work in an entirely different area, i'm doing this to help out the people I work for). Any help is much appreciated! :)


Comments

  • Registered Users Posts: 52 ✭✭iFergal


    To remove the email text field - remove the following in contactform.php
    <div class='container'>
        <label for='email' >Email Address*:</label><br/>
        <input type='text' name='email' id='email' value='<?php echo $formproc->SafeDisplay('email') ?>' maxlength="50" /><br/>
        <span id='contactus_email_errorloc' class='error'></span>
    </div>
    

    There are other bits that you would need to remove that are related to the email, only had a quick look.


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


    iFergal wrote: »
    There are other bits that you would need to remove that are related to the email, only had a quick look.

    This bit also likely needs to be edited out of contactform.php
    
        frmvalidator.addValidation("email","email","Please provide a valid email address");
    

    The code in the previous post just displays the email field, but the above removes the email field from being validated ie. required.


  • Closed Accounts Posts: 249 ✭✭OneIdea


    At a glance contactform.php validation section shows the following:
    [PHP]
    <script type='text/javascript'>
    // <![CDATA[

    var frmvalidator = new Validator("contactus");
    frmvalidator.EnableOnPageErrorDisplay();
    frmvalidator.EnableMsgsTogether();
    frmvalidator.addValidation("name","req","Please provide your name");

    frmvalidator.addValidation("email","req","Please provide your email address");

    frmvalidator.addValidation("email","email","Please provide a valid email address");

    frmvalidator.addValidation("message","maxlen=2048","The message is too long!(more than 2KB!)");

    // ]]>
    </script>
    [/PHP]

    You could simple remove these two lines:
    [PHP]
    frmvalidator.addValidation("email","req","Please provide your email address");

    frmvalidator.addValidation("email","email","Please provide a valid email address");
    [/PHP]

    But I suggest you replace the two lines of code, as in the future you may wish to implement that feature back?

    Replace with this:
    [PHP]
    /* frmvalidator.addValidation("email","req","Please provide your email address"); */

    /* frmvalidator.addValidation("email","email","Please provide a valid email address"); */
    [/PHP]

    ...and let us know how you get on?


  • Closed Accounts Posts: 89 ✭✭Fear_an_tarbh


    Thanks for the quick replies and your help,

    I've tried all of those suggestions but it still asks *please provide your email address*

    I double checked all the files to make sure I saved it correctly.
    Strange one!


  • Closed Accounts Posts: 249 ✭✭OneIdea


    In conjunction to my post above open include/fgcontactform.php

    Find from line number 375
    [PHP]//email validations
    if(empty($_POST))[/PHP]
    ..and replace with
    [PHP]//email validations
    /*if(empty($_POST))[/PHP]
    Find from line number 391
    [PHP] }

    //message validaions[/PHP]
    ..and replace with
    [PHP] }*/

    //message validaions[/PHP]
    That should be it?


  • Advertisement
  • Closed Accounts Posts: 89 ✭✭Fear_an_tarbh


    ......and that works perfectly! :cool:

    Thanks so much for all your replies. I've learned a little bit more this evening.

    (btw I am using notepad++, so I could see the numbered lines)


Advertisement