Matte01990 Posted November 18, 2016 Share Posted November 18, 2016 $this->fields_form = array( 'legend' => array( 'title' => $this->l('Add/Edit Box') ), 'input' => array( array( 'type' => 'text', 'label' => 'Nome', 'name' => 'nome', 'value' => 'test', ), ), ) How could I set default value to this field? Setting a ''value'' is useless. Thank you. Link to comment Share on other sites More sharing options...
fedesib Posted November 18, 2016 Share Posted November 18, 2016 Hi there, in your install function use: Configuration::updateValue('nome', 'test'); Of course if you have multiple fields you'd better create an array and a recursive function to set default values, but in general, the above approach should work. I hope this helps! Federica Link to comment Share on other sites More sharing options...
Matte01990 Posted November 18, 2016 Author Share Posted November 18, 2016 Thank you Federica I need to retrieve some data from db and to display them in the open form, this will helps ! Link to comment Share on other sites More sharing options...
NemoPS Posted November 19, 2016 Share Posted November 19, 2016 you have to use $this->tpl_vars = array('fields_value' => array...)WHere the fields value array has the same keys as your fields Link to comment Share on other sites More sharing options...
Matte01990 Posted November 21, 2016 Author Share Posted November 21, 2016 (edited) you have to use $this->tpl_vars = array('fields_value' => array...) WHere the fields value array has the same keys as your fields Hello NemoPS and thank you for answering. Can you tell me where to insert this code? Shold I insert it into my module's renderForm() function? Edited November 21, 2016 by Matte01990 (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted November 23, 2016 Share Posted November 23, 2016 before returning the template, I cover the helper form in my modules course if you are interested (will be 20% off on black friday) 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