Magento registration returns 'Last name cannot be empty'mage::getModel('module/model')->getData returns an empty arraygetting customers namesCheckout saveBilling generates error due to extractData method not working properlyHow to make last name optional in Magento 1.8Automatic Customer Group change based on VAT-ID: Force Magento to check and display message when customer gets to checkout pageValidation last name error in checkout cartMagento Model returns empty data arrayFirst Name and Last Name not allowing to use Latin letterRemove fields from registration formMagento 2: add Validation on first name and last name so it only accept text value, not numeric

Why does Hellboy file down his horns?

Is purchasing foreign currency before going abroad a losing proposition?

What happens as wavelengths of sound waves approach tens of micrometers?

How do I take a fraction to a negative power?

Does throwing a penny at a train stop the train?

Turning arguments into exponents

Why was hardware diversification an asset for the IBM PC ecosystem?

Storming Area 51

Why did my rum cake turn black?

Do you know your 'KVZ's?

What's the maximum time an interrupt service routine can take to execute on atmega328p?

What explains 9 speed cassettes price differences?

Machine learning and operations research projects

What are some examples of special things about Russian?

definition of "percentile"

Cubic programming and beyond?

What's an appropriate title for a person who deals with conflicts of an Empire?

Supporting developers who insist on using their pet language

Rhombuses, kites etc

What would be the ideal melee weapon made of "Phase Metal"?

How might the United Kingdom become a republic?

Why do players in the past play much longer tournaments than today's top players?

I wrote two alternate fugue expositions for one subject do both follow good harmonic conventions?

Is Trump personally blocking people on Twitter?



Magento registration returns 'Last name cannot be empty'


mage::getModel('module/model')->getData returns an empty arraygetting customers namesCheckout saveBilling generates error due to extractData method not working properlyHow to make last name optional in Magento 1.8Automatic Customer Group change based on VAT-ID: Force Magento to check and display message when customer gets to checkout pageValidation last name error in checkout cartMagento Model returns empty data arrayFirst Name and Last Name not allowing to use Latin letterRemove fields from registration formMagento 2: add Validation on first name and last name so it only accept text value, not numeric






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3















I am trying to deploy Magento 1.9.2.1. I used the package from the official site.



But a strange thing happened to me. Among all the instances I deploy, it fails at any page that requires validation of a customer information (registration, etc.). It returns the error 'Last name cannot be empty'. But even stranger, there were 1 or 2 times of success before the errors. That is, the error only happens after I have created 1 or 2 accounts.



I found that the validation method is in the model, as:



if (!Zend_Validate::is( trim($this->getLastname()) , 'NotEmpty')) 
$errors[] = Mage::helper('customer')->__('The last name cannot be empty.');



So I added some lines before it.



$errors[] = Mage::helper('customer')->__('The first name cannot be empty.');
$errors[] = Mage::helper('customer')->__($this->getFirstName());
$errors[] = Mage::helper('customer')->__($this->getLastName());
$errors[] = Mage::helper('customer')->__($this->getEmail());


This time there are 5 errors displayed at the registration page. As expected, the first is 'The first name cannot be empty.'. But the second and third are all empty. The fourth is the email address I typed in.



Here comes another problem. The validation of the first name comes before that of the last name. Were they all empty, how could the error message be only 'The last name cannot be empty.'?



And more substantially, why can I register at the very beginning? What is the substantial problem?



UPDATE: If I comment the validation for the two names, there are no more errors. But the account created has its last name empty, while first name as I typed in.



UPDATE 2:



print_r($this->getRequest()->getPost('lastname'));
print_r($this->getRequest()->getPost('firstname'));


These lines gives the posted data as expected.










share|improve this question
























  • Are the names included in the POST data when submitting the registration form? Are the parameter keys correct (firstname, lastname)? Your error message will not include the names because you misspelled the accessors (Firstname vs. FirstName).

    – mam08ixo
    Aug 12 '15 at 10:01











  • @mam08ixo, thanks. I fixed the accessors, I got the last name empty while the first name normal. The post data looks normal. So the problem is in the middle I guess. But.I don't quite understand the getregistry thing and something else which I suppose is how magento process the data posted. Are there any good explanations on this?

    – Colliot
    Aug 12 '15 at 18:02











  • I guess it starts with the public function createPostAction(), within which there is a $customer = $this->_getCustomer();, and the protected function _getCustomer() involves some $customer = $this->_getFromRegistry('current_customer');. I can hardly see how the posted data is processed.

    – Colliot
    Aug 12 '15 at 18:05











  • I am pretty sure the magic happens at _getCustomerErrors() but ain't got my debugging equipment at hand right now.

    – mam08ixo
    Aug 12 '15 at 21:03











  • @mam08ixo, well I now think that it maybe the problem of the middle name. In the template given to me, the middle name is.removed. I guess they did not adjust the model, so the posted last name was fed to the middle name, thus the last name empty. How can I check my hypothesis?

    – Colliot
    Aug 13 '15 at 12:33

















3















I am trying to deploy Magento 1.9.2.1. I used the package from the official site.



But a strange thing happened to me. Among all the instances I deploy, it fails at any page that requires validation of a customer information (registration, etc.). It returns the error 'Last name cannot be empty'. But even stranger, there were 1 or 2 times of success before the errors. That is, the error only happens after I have created 1 or 2 accounts.



I found that the validation method is in the model, as:



if (!Zend_Validate::is( trim($this->getLastname()) , 'NotEmpty')) 
$errors[] = Mage::helper('customer')->__('The last name cannot be empty.');



So I added some lines before it.



$errors[] = Mage::helper('customer')->__('The first name cannot be empty.');
$errors[] = Mage::helper('customer')->__($this->getFirstName());
$errors[] = Mage::helper('customer')->__($this->getLastName());
$errors[] = Mage::helper('customer')->__($this->getEmail());


This time there are 5 errors displayed at the registration page. As expected, the first is 'The first name cannot be empty.'. But the second and third are all empty. The fourth is the email address I typed in.



Here comes another problem. The validation of the first name comes before that of the last name. Were they all empty, how could the error message be only 'The last name cannot be empty.'?



And more substantially, why can I register at the very beginning? What is the substantial problem?



UPDATE: If I comment the validation for the two names, there are no more errors. But the account created has its last name empty, while first name as I typed in.



UPDATE 2:



print_r($this->getRequest()->getPost('lastname'));
print_r($this->getRequest()->getPost('firstname'));


These lines gives the posted data as expected.










share|improve this question
























  • Are the names included in the POST data when submitting the registration form? Are the parameter keys correct (firstname, lastname)? Your error message will not include the names because you misspelled the accessors (Firstname vs. FirstName).

    – mam08ixo
    Aug 12 '15 at 10:01











  • @mam08ixo, thanks. I fixed the accessors, I got the last name empty while the first name normal. The post data looks normal. So the problem is in the middle I guess. But.I don't quite understand the getregistry thing and something else which I suppose is how magento process the data posted. Are there any good explanations on this?

    – Colliot
    Aug 12 '15 at 18:02











  • I guess it starts with the public function createPostAction(), within which there is a $customer = $this->_getCustomer();, and the protected function _getCustomer() involves some $customer = $this->_getFromRegistry('current_customer');. I can hardly see how the posted data is processed.

    – Colliot
    Aug 12 '15 at 18:05











  • I am pretty sure the magic happens at _getCustomerErrors() but ain't got my debugging equipment at hand right now.

    – mam08ixo
    Aug 12 '15 at 21:03











  • @mam08ixo, well I now think that it maybe the problem of the middle name. In the template given to me, the middle name is.removed. I guess they did not adjust the model, so the posted last name was fed to the middle name, thus the last name empty. How can I check my hypothesis?

    – Colliot
    Aug 13 '15 at 12:33













3












3








3








I am trying to deploy Magento 1.9.2.1. I used the package from the official site.



But a strange thing happened to me. Among all the instances I deploy, it fails at any page that requires validation of a customer information (registration, etc.). It returns the error 'Last name cannot be empty'. But even stranger, there were 1 or 2 times of success before the errors. That is, the error only happens after I have created 1 or 2 accounts.



I found that the validation method is in the model, as:



if (!Zend_Validate::is( trim($this->getLastname()) , 'NotEmpty')) 
$errors[] = Mage::helper('customer')->__('The last name cannot be empty.');



So I added some lines before it.



$errors[] = Mage::helper('customer')->__('The first name cannot be empty.');
$errors[] = Mage::helper('customer')->__($this->getFirstName());
$errors[] = Mage::helper('customer')->__($this->getLastName());
$errors[] = Mage::helper('customer')->__($this->getEmail());


This time there are 5 errors displayed at the registration page. As expected, the first is 'The first name cannot be empty.'. But the second and third are all empty. The fourth is the email address I typed in.



Here comes another problem. The validation of the first name comes before that of the last name. Were they all empty, how could the error message be only 'The last name cannot be empty.'?



And more substantially, why can I register at the very beginning? What is the substantial problem?



UPDATE: If I comment the validation for the two names, there are no more errors. But the account created has its last name empty, while first name as I typed in.



UPDATE 2:



print_r($this->getRequest()->getPost('lastname'));
print_r($this->getRequest()->getPost('firstname'));


These lines gives the posted data as expected.










share|improve this question
















I am trying to deploy Magento 1.9.2.1. I used the package from the official site.



But a strange thing happened to me. Among all the instances I deploy, it fails at any page that requires validation of a customer information (registration, etc.). It returns the error 'Last name cannot be empty'. But even stranger, there were 1 or 2 times of success before the errors. That is, the error only happens after I have created 1 or 2 accounts.



I found that the validation method is in the model, as:



if (!Zend_Validate::is( trim($this->getLastname()) , 'NotEmpty')) 
$errors[] = Mage::helper('customer')->__('The last name cannot be empty.');



So I added some lines before it.



$errors[] = Mage::helper('customer')->__('The first name cannot be empty.');
$errors[] = Mage::helper('customer')->__($this->getFirstName());
$errors[] = Mage::helper('customer')->__($this->getLastName());
$errors[] = Mage::helper('customer')->__($this->getEmail());


This time there are 5 errors displayed at the registration page. As expected, the first is 'The first name cannot be empty.'. But the second and third are all empty. The fourth is the email address I typed in.



Here comes another problem. The validation of the first name comes before that of the last name. Were they all empty, how could the error message be only 'The last name cannot be empty.'?



And more substantially, why can I register at the very beginning? What is the substantial problem?



UPDATE: If I comment the validation for the two names, there are no more errors. But the account created has its last name empty, while first name as I typed in.



UPDATE 2:



print_r($this->getRequest()->getPost('lastname'));
print_r($this->getRequest()->getPost('firstname'));


These lines gives the posted data as expected.







model validation form-validation






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 12 '15 at 18:42







Colliot

















asked Aug 12 '15 at 9:50









ColliotColliot

1236 bronze badges




1236 bronze badges












  • Are the names included in the POST data when submitting the registration form? Are the parameter keys correct (firstname, lastname)? Your error message will not include the names because you misspelled the accessors (Firstname vs. FirstName).

    – mam08ixo
    Aug 12 '15 at 10:01











  • @mam08ixo, thanks. I fixed the accessors, I got the last name empty while the first name normal. The post data looks normal. So the problem is in the middle I guess. But.I don't quite understand the getregistry thing and something else which I suppose is how magento process the data posted. Are there any good explanations on this?

    – Colliot
    Aug 12 '15 at 18:02











  • I guess it starts with the public function createPostAction(), within which there is a $customer = $this->_getCustomer();, and the protected function _getCustomer() involves some $customer = $this->_getFromRegistry('current_customer');. I can hardly see how the posted data is processed.

    – Colliot
    Aug 12 '15 at 18:05











  • I am pretty sure the magic happens at _getCustomerErrors() but ain't got my debugging equipment at hand right now.

    – mam08ixo
    Aug 12 '15 at 21:03











  • @mam08ixo, well I now think that it maybe the problem of the middle name. In the template given to me, the middle name is.removed. I guess they did not adjust the model, so the posted last name was fed to the middle name, thus the last name empty. How can I check my hypothesis?

    – Colliot
    Aug 13 '15 at 12:33

















  • Are the names included in the POST data when submitting the registration form? Are the parameter keys correct (firstname, lastname)? Your error message will not include the names because you misspelled the accessors (Firstname vs. FirstName).

    – mam08ixo
    Aug 12 '15 at 10:01











  • @mam08ixo, thanks. I fixed the accessors, I got the last name empty while the first name normal. The post data looks normal. So the problem is in the middle I guess. But.I don't quite understand the getregistry thing and something else which I suppose is how magento process the data posted. Are there any good explanations on this?

    – Colliot
    Aug 12 '15 at 18:02











  • I guess it starts with the public function createPostAction(), within which there is a $customer = $this->_getCustomer();, and the protected function _getCustomer() involves some $customer = $this->_getFromRegistry('current_customer');. I can hardly see how the posted data is processed.

    – Colliot
    Aug 12 '15 at 18:05











  • I am pretty sure the magic happens at _getCustomerErrors() but ain't got my debugging equipment at hand right now.

    – mam08ixo
    Aug 12 '15 at 21:03











  • @mam08ixo, well I now think that it maybe the problem of the middle name. In the template given to me, the middle name is.removed. I guess they did not adjust the model, so the posted last name was fed to the middle name, thus the last name empty. How can I check my hypothesis?

    – Colliot
    Aug 13 '15 at 12:33
















Are the names included in the POST data when submitting the registration form? Are the parameter keys correct (firstname, lastname)? Your error message will not include the names because you misspelled the accessors (Firstname vs. FirstName).

– mam08ixo
Aug 12 '15 at 10:01





Are the names included in the POST data when submitting the registration form? Are the parameter keys correct (firstname, lastname)? Your error message will not include the names because you misspelled the accessors (Firstname vs. FirstName).

– mam08ixo
Aug 12 '15 at 10:01













@mam08ixo, thanks. I fixed the accessors, I got the last name empty while the first name normal. The post data looks normal. So the problem is in the middle I guess. But.I don't quite understand the getregistry thing and something else which I suppose is how magento process the data posted. Are there any good explanations on this?

– Colliot
Aug 12 '15 at 18:02





@mam08ixo, thanks. I fixed the accessors, I got the last name empty while the first name normal. The post data looks normal. So the problem is in the middle I guess. But.I don't quite understand the getregistry thing and something else which I suppose is how magento process the data posted. Are there any good explanations on this?

– Colliot
Aug 12 '15 at 18:02













I guess it starts with the public function createPostAction(), within which there is a $customer = $this->_getCustomer();, and the protected function _getCustomer() involves some $customer = $this->_getFromRegistry('current_customer');. I can hardly see how the posted data is processed.

– Colliot
Aug 12 '15 at 18:05





I guess it starts with the public function createPostAction(), within which there is a $customer = $this->_getCustomer();, and the protected function _getCustomer() involves some $customer = $this->_getFromRegistry('current_customer');. I can hardly see how the posted data is processed.

– Colliot
Aug 12 '15 at 18:05













I am pretty sure the magic happens at _getCustomerErrors() but ain't got my debugging equipment at hand right now.

– mam08ixo
Aug 12 '15 at 21:03





I am pretty sure the magic happens at _getCustomerErrors() but ain't got my debugging equipment at hand right now.

– mam08ixo
Aug 12 '15 at 21:03













@mam08ixo, well I now think that it maybe the problem of the middle name. In the template given to me, the middle name is.removed. I guess they did not adjust the model, so the posted last name was fed to the middle name, thus the last name empty. How can I check my hypothesis?

– Colliot
Aug 13 '15 at 12:33





@mam08ixo, well I now think that it maybe the problem of the middle name. In the template given to me, the middle name is.removed. I guess they did not adjust the model, so the posted last name was fed to the middle name, thus the last name empty. How can I check my hypothesis?

– Colliot
Aug 13 '15 at 12:33










1 Answer
1






active

oldest

votes


















0














Check if lastname attribute is present in your customer_form_attribute table for checkout_register form and other forms.



To list available fields on checkout_register form, use:



SELECT `main_table`.*, ea.attribute_code
FROM `customer_form_attribute` AS `main_table`
inner join eav_attribute ea on main_table.attribute_id = ea.attribute_id
WHERE (`main_table`.`form_code` = 'checkout_register')


in my case it was missing firstname



Note the solution above is for registering customer on checkout form only.
To get a list of available forms do SELECT * FROM customer_form_attribute.



Possible causes



In my case the problem happened after editing the attribute in admin, using a module that ignored the existence of checkout_register form (Clarion_Customerattribute).






share|improve this answer

























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "479"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f78456%2fmagento-registration-returns-last-name-cannot-be-empty%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Check if lastname attribute is present in your customer_form_attribute table for checkout_register form and other forms.



    To list available fields on checkout_register form, use:



    SELECT `main_table`.*, ea.attribute_code
    FROM `customer_form_attribute` AS `main_table`
    inner join eav_attribute ea on main_table.attribute_id = ea.attribute_id
    WHERE (`main_table`.`form_code` = 'checkout_register')


    in my case it was missing firstname



    Note the solution above is for registering customer on checkout form only.
    To get a list of available forms do SELECT * FROM customer_form_attribute.



    Possible causes



    In my case the problem happened after editing the attribute in admin, using a module that ignored the existence of checkout_register form (Clarion_Customerattribute).






    share|improve this answer



























      0














      Check if lastname attribute is present in your customer_form_attribute table for checkout_register form and other forms.



      To list available fields on checkout_register form, use:



      SELECT `main_table`.*, ea.attribute_code
      FROM `customer_form_attribute` AS `main_table`
      inner join eav_attribute ea on main_table.attribute_id = ea.attribute_id
      WHERE (`main_table`.`form_code` = 'checkout_register')


      in my case it was missing firstname



      Note the solution above is for registering customer on checkout form only.
      To get a list of available forms do SELECT * FROM customer_form_attribute.



      Possible causes



      In my case the problem happened after editing the attribute in admin, using a module that ignored the existence of checkout_register form (Clarion_Customerattribute).






      share|improve this answer

























        0












        0








        0







        Check if lastname attribute is present in your customer_form_attribute table for checkout_register form and other forms.



        To list available fields on checkout_register form, use:



        SELECT `main_table`.*, ea.attribute_code
        FROM `customer_form_attribute` AS `main_table`
        inner join eav_attribute ea on main_table.attribute_id = ea.attribute_id
        WHERE (`main_table`.`form_code` = 'checkout_register')


        in my case it was missing firstname



        Note the solution above is for registering customer on checkout form only.
        To get a list of available forms do SELECT * FROM customer_form_attribute.



        Possible causes



        In my case the problem happened after editing the attribute in admin, using a module that ignored the existence of checkout_register form (Clarion_Customerattribute).






        share|improve this answer













        Check if lastname attribute is present in your customer_form_attribute table for checkout_register form and other forms.



        To list available fields on checkout_register form, use:



        SELECT `main_table`.*, ea.attribute_code
        FROM `customer_form_attribute` AS `main_table`
        inner join eav_attribute ea on main_table.attribute_id = ea.attribute_id
        WHERE (`main_table`.`form_code` = 'checkout_register')


        in my case it was missing firstname



        Note the solution above is for registering customer on checkout form only.
        To get a list of available forms do SELECT * FROM customer_form_attribute.



        Possible causes



        In my case the problem happened after editing the attribute in admin, using a module that ignored the existence of checkout_register form (Clarion_Customerattribute).







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 30 at 5:17









        Ricardo MartinsRicardo Martins

        7165 silver badges22 bronze badges




        7165 silver badges22 bronze badges



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f78456%2fmagento-registration-returns-last-name-cannot-be-empty%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

            Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

            Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form