I have created a custom module for Distributor registration its having a custom form with some extra fields for registration. Distributor registration is working fine but i am not able to retain the form filed value in case there if there is server side validation error.
I have tried to followed customer registration module and form and found that Magento keeps the value in session like this.
in CreatePost.php controller
$this->session->setCustomerFormData($this->getRequest()->getPostValue());
and retaining the form value by bellow line of code in form.
<?php echo $block->escapeHtml($block->getFormData()->getCity()) ?>
Is there any other way i can use to keep the form filled in case of validation error ?