How to set default value to the text fields in volt from the values sent to the view from controller?

Hi, I want to set a default value to the text field which are sent to the view from controller . here i have sent the corporatename from controller $this->view->corporatename=$corporate_name

                           <div class="form-group" align="left" >
                                <p> Company Name</p>
                                <div class="controls">
                                    {{ text_field('user_name', 'class': "form-control",'readonly': 'true','value': {{corporate_name}} }}
                                </div>
                            </div>

How to do this?? Please Help!!!



331
{{ text_field('user_name', 'class': "form-control",'readonly': 'true','value': corporate_name ) }}


30.7k

hi,

you have to use:

// in controller

$this->tag->setDefault("user_name", $corporate_name);