How customer edit forms are populated in Magento 2

by summu   Last Updated June 13, 2019 11:09 AM

It looks like magic to me, but I am not able to figure out how Magento 2 is populating the values in the form I can't see any value in the value attribute. but the text boxes are somehow magically populated.

How is this happening?

enter image description here

As I inspect in chrome I see this.


   <div class="field city required">
        <label class="label" for="city"><span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('city') ?></span></label>
        <div class="control">
            <input type="text"
                   value="<?= $block->escapeHtmlAttr($block->getAddress()->getCity()) ?>"
                   title="<?= $block->escapeHtmlAttr(__('City')) ?>"
                   class="input-text <?= $block->escapeHtmlAttr($this->helper(\Magento\Customer\Helper\Address::class)->getAttributeValidationClass('city')) ?>"
                   data-validate="{required:true, 'validate-alphanum-with-spaces':true}"


If the value attribute is not getting set then how this text box is getting magically populated .

Related Questions

Updated July 26, 2019 13:09 PM

Updated May 29, 2019 15:09 PM

Updated August 16, 2018 07:09 AM

Updated August 09, 2019 07:09 AM

Updated February 21, 2017 13:09 PM