Miko. eCommerce Template

Mon. - Fri. 9 am - 5 pm Ask a Question
Remember me

Check if e-mail already exists

2 months 3 weeks ago #1

  • Vanderlei Frari's Avatar
  • Vanderlei Frari
  • Posts: 70
Hi, folks.
I have a newsletter form with name and email. It's not uncommon people to sign it twice. I'd like to avoid this. Is there any script to check if the email already existis in data base and notify the client about this?
Thanks

2 months 3 weeks ago #2

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 16531
Hello,
Thank you for contacting us

Unfortunately there is no such possibility

Regards,
Vyacheslav, Balbooa.com

2 months 3 weeks ago #3

  • Vanderlei Frari's Avatar
  • Vanderlei Frari
  • Posts: 70
It is a pity!

Could you tell me if the custom button php script runs before or after inserting data into the database?

Thanks

2 months 3 weeks ago #4

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 16531
The script is executed after writing to the database

Best Regards,
Vyacheslav, Balbooa Support Team

2 months 3 weeks ago #5

  • Vanderlei Frari's Avatar
  • Vanderlei Frari
  • Posts: 70
Thanks, Vyacheslav

I made a PHP script + jquery to check database when the user fills e-mail field. It's working fine. It's trigered through field blur.

I'm using an alert message "your e-mail already exists in our database" but I'd like to simple disable button and change its text. Instead of "SUBMIT", "your e-mail already exists in our database".

Take a look of my code:
jQuery(function($) {
  $('.mail-checker input[type="email"]').blur(function() {
    var user_mail = $(this).val().trim();
    if (user_mail != '') {
      $.ajax({
        url: 'includes/checker.php',
        type: 'post',
        data: { user_mail: user_mail },
        success: function(data) {
          if (data == 'not_avaiable') {
            // alert("This e-mail already exists in our database");
			  $('.button-to-disable').addClass('disabled');
            return false;
          }
        }
      });
    };
  });
});

Any ideia to acomplish this task?

2 months 3 weeks ago #6

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 16531
You need to replace the line in your code with this one (add text change)
$('.button-to-disable').addClass('disabled').find('.ba-form-submit-title').text('your e-mail already exists in our database');

and add css code
.button-to-disable.disabled {
    pointer-events: none !important;
}

Best Regards,
Vyacheslav, Balbooa Support Team

2 months 3 weeks ago #7

  • Vanderlei Frari's Avatar
  • Vanderlei Frari
  • Posts: 70
Thanks, Vyacheslav. Works fine!

2 months 3 weeks ago #8

  • Vyacheslav's Avatar
  • Vyacheslav
  • Posts: 16531
You are welcome ;)
Powered by Kunena Forum