Problem validating emails

  • Donal
  • Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
9 years 2 months ago #92842 by Donal
Problem validating emails was created by Donal
Hi,
I'm using an email field on my registration form, with the following validation.
validate[required,custom

Please Log in or Create an account to join the conversation.

More
9 years 2 months ago #92884 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Problem validating emails
Look at the file components/com_eventbooking/controller/controller.php, find the method validate_email , add the trim command to the code should help solving the issue

Tuan

Please Log in or Create an account to join the conversation.

  • Donal
  • Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
9 years 2 months ago #92913 by Donal
Replied by Donal on topic Problem validating emails
Hi Tuan,

I edited a line in validate_email to
Code:
$email = trim($this->input->get('fieldValue', '', 'string'));
but I still get the Ajax error telling me the email is invalid if I add a space at the end of the email.

Thanks for the help,
Donal

Please Log in or Create an account to join the conversation.

More
9 years 2 months ago #92915 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Problem validating emails
Hello Donal

I am afraid of it is not the AJAX error. There is regular expression which validate the format of the email using javascript

You can look at components/com_eventbooking/helper/jquery.php, look at the line 287 and try to change that regular expression to solve the issue

Sorry, I am not good at regular expression (it is a complicated thing to me) to help with the change

Regards,

Tuan

Please Log in or Create an account to join the conversation.

  • Donal
  • Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
9 years 2 months ago #92948 by Donal
Replied by Donal on topic Problem validating emails
Hi,

I modified the regular expression, so the extra space was allowed by the validation. I thought I had the problem solved when I combined the regex adjustment with the trim function, but unfortuantely, event booking emails weren't being sent to the customer with the trailing space. I found another place where I thought a trim would be required. In /components/com_eventbooking/controller/register.php, but that still didn't fix the issue.

In the end of the day, I adopted a far easier solution: The AJAX warning that appears now tells the customer to check for any trailing spaces!

Regards,
Donal

Please Log in or Create an account to join the conversation.

More
9 years 2 months ago #92957 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic Problem validating emails
OK Donal. The most important thing is it works

Tuan

Please Log in or Create an account to join the conversation.

Moderators: Tuan Pham Ngoc