cancel
Showing results for 
Search instead for 
Did you mean: 

AJAX field validation with data check

SOLVED

AJAX field validation with data check

Hi,

 

I want to allow only unique user account names in the system, so I added a new field which is stored in the customer entity.

Now I'm searching for an ajax solution for the customer registration form, which checks the new field.

I'd prefer build in functionality of Magento.

 

Do you have suggestions?

 

Thanks.

 

Regards.

Marco

1 REPLY

Re: AJAX field validation with data check

Hello,

 

I have a suggestion for you.

Account create controller: app/code/core/Mage/Customer/controllers/AccountController.php 

#app/code/core/Mage/Customer/controllers/AccountController.php
public function createPostAction()
{
  ...
}

We use JSON to return result. Our JSON has two keys:

-‘status’  has two values : ERROR and SUCCESS

-‘message’ => associated with its status.

We will create an array to store ‘status’ and ‘message’, and then use jsonEncode() to convert array to JSON format.

 

You should read this tutorial about Ajax Newsletter. We can apply this "JSON" rule in your Ajax Customer.

 

Problem solved? Click Accept as Solution!