Contact Form Email Validation - by amitkrsinghal

This topic has 10 replies, 3 voices, and was last updated 8 years, 6 months ago ago by Jack Richardson

  • Avatar: amitkrsinghal
    amitkrsinghal
    Participant
    April 18, 2016 at 10:47

    Hi,
    I am not able to validate the e-mail field in the Blanco theme’s contact form. User can write anything in the field even other then the e-mail address. Is there a way I can

    9 Answers
    Avatar: Eva
    Eva Kemp
    Support staff
    April 18, 2016 at 11:45

    Hello,

    Please provide us with FTP and wp-admin panel credentials in Private Content.

    Regards,
    Eva Kemp.

    Avatar: amitkrsinghal
    amitkrsinghal
    Participant
    April 18, 2016 at 15:16

    I need to take permission from the client before sending the Production Site Credentials. Will it work if I send you the details of our beta site rather then the production site? Which is the clone of the production site.

    http://obaststenv.in/cms
    username : admin
    Password : admin

    Avatar: Eva
    Eva Kemp
    Support staff
    April 18, 2016 at 15:23

    Hello,

    In this case edit the file wp-content/themes/blanco/code/shortcodes.php and after line 125 add this code:

    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
          $emailErr = "Invalid email format";
          return $emailErr;
    }

    Regards,
    Eva Kemp.

    Avatar: amitkrsinghal
    amitkrsinghal
    Participant
    April 19, 2016 at 19:12

    I edited the file in our beta site as per your instruction, but it didn’t work.

    I used wp-admin to edit Blanco: shortcodes.php (code/shortcodes.php).

    you an please check it here. http://obaststenv.in/cms/contact-us/

    Please, contact administrator
    for this information.
    Avatar: Eva
    Eva Kemp
    Support staff
    April 20, 2016 at 09:24

    Hello,

    Please provide us with FTP credentials.

    Regards,
    Eva Kemp.

    Avatar: amitkrsinghal
    amitkrsinghal
    Participant
    April 21, 2016 at 14:15

    FTP details are in private section

    Please, contact administrator
    for this information.
    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    April 22, 2016 at 21:35

    Hello,

    Please take our apologies for delay.
    I’ve added the following code in the wp-content/themes/blanco-3/js/script.js file in lines 338-344:

    ethemeContactForm.find('.email').each(function(){
      var re = /[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}/igm;
      if (jQuery(this).val() == '' || !re.test(jQuery(this).val())) {
        errmsg = "Please, enter a valid e-mail address!";
        jQuery(this).addClass('validation-failed');
      }
    });

    Clear browser cache and check the contact form now.

    Best regards,
    Jack Richardson.

    Avatar: amitkrsinghal
    amitkrsinghal
    Participant
    May 6, 2016 at 13:09

    thanks Jack, Fix is working.

    Do you have intention to include it in your next version upgrade? Otherwise, with next version upgrade, our fix may get over-written.

    Avatar: Jack Richardson
    Jack Richardson
    Support staff
    May 6, 2016 at 13:52

    Hello,

    You’re welcome.
    We passed this query to our developers.
    It should be fixed in the next theme update.

    Best regards,
    Jack Richardson.

  • Viewing 10 results - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.