Santanu123 Posted February 1, 2016 Share Posted February 1, 2016 Hi All, I am using prestashop 1.6+ and when I am giving a space in any of the address field like Name, Ph No, Mobile no etc. all the fields are taking this and it is showing ok whereas I Have not given any character. Need solution. Thanks, Santanu Link to comment Share on other sites More sharing options...
polosat Posted March 9, 2016 Share Posted March 9, 2016 Maybe it's too late, but hopefully it will be helpful.You have to edit file /js/validate.jsAt the end of that file you can see this code: $(document).on('focusout', 'input.validate, textarea.validate', function() { validate_field(this); }); Replace it by the following: $(document).on('focusout', 'input.validate, textarea.validate', function() { // trim spaces $(this).val($(this).val().trim()); validate_field(this); }); Then you need to create an override of Address class (create or edit file /override/classes/Address.php)Place there the following code: <?php class Address extends AddressCore { /** * @see ObjectModel::validateController() */ public function validateController($htmlentities = true) { // remove whitespaces from the beginning and end of a input data $_POST = array_map('trim', $_POST); return parent::validateController($htmlentities); } } 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now