I've seen lots of people discussing this, but no one has asked the same question / answer I'm looking for here, I currently have a store running fine, on checkout the email is required (as you'd expect) - but if the user enters .com32 I get the following message:

‘domain.events’ appears to be a DNS hostname but cannot match TLD against known list

This displays as an alert box - i've discovered that the code for the TLD validation is inside of:


And have made a copy to local like so:


And commented out the following:

if (!in_array($this->_tld, $this->_validTlds)) {
    // $this->_error(self::UNKNOWN_TLD);
    // $status = false;
    // break;

My problem is, I want the email form field to show the error message (Please enter a valid email address. For example [email protected].), and not an alert.

How would I go about doing this? Is it even possible?

1 Answer 1


Are you using onepage checkout? Or the default checkout? I'm working on a store, and the theme we installed has this option by default (See Image Below). My downloaded theme files would be different than your theme would be, but If you don't want to go and download a different theme your best bet would be to go find the onepage checkout page, or your checkout/cart page. Look in the folder app/design/frontend/base/default/template/checkout for a file onepage.phtml or /onepage/billing.phtml and those will contain the fields with the email input during checkout. You may also want to checkout the front end JS files which can be found in the /skin/frontend/base/default/js folder, and look for checkout/review.js This may contain relevant error handling code that you could manipulate.

I wouldn't be able to provide much relevant code without seeing more information, but in general, you would just need to create a custom function that gets called instead of the alert() when the ajax response is recieved, and create a custom element below your email field which gets filled with the custom error message by your function. If that makess sense at all.

Email Error Picture

  • Thanks for the comment Iqbal, im working inside of /onepage/billing.phtml & i guess that it was a ajax call but i could figure out where. What extra source would i need to provide for a little more help? Thanks again.
    – andy jones
    Dec 14, 2016 at 19:48
  • Great, already halfway there then, I remembered I forgot to leave out one bit of information. When you click the continue button on the onepage checkout, it saves the billing, and tries to continue to the next step. The main JS file is uses is located in the file: /skin/frontend/base/default/js/opcheckout.js On line 290 is where you'll find the Billing class, and on line 361 is the save method and on 394 is the nextStep method. That's where you'll be able to find relevant code for your error messages I think
    – Iqbal Khan
    Dec 14, 2016 at 20:17
  • Maybe add in some code of your billing template where you're trying to insert your message, and how you're trying to do it with the AJAX response. I'd say before you worry about getting it to display on the page asynchronously, get to the point where you can change your alert() message so you know where the code for that lives
    – Iqbal Khan
    Dec 14, 2016 at 20:19
  • Thanks, i will update you how i get on tomorrow morning.
    – andy jones
    Dec 14, 2016 at 21:58
  • I still can't seem to find the alert inside of /js/opcheckout.js , around line 383 there is an Ajax.Request but nowhere there can i see a validation check. I'm starting to feel like it's a lost cause >:(
    – andy jones
    Dec 15, 2016 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.