XavierPKP Posted October 21, 2014 Share Posted October 21, 2014 Hi, I'm creating my personnal module and his back office. Actually, I have a list of element (a select) and I would like this same list, but with a parameter 'selected' on the right place. i'm using the classe helperForm to generate my forms. My actual code: $combo = $this->getAddFieldsValues(); $fields_form = array( 'form' => array( 'legend' => array( 'title' => $this->l('Ajouter un element'), 'icon' => 'icon-cogs' ), 'input' => array( array( 'type' => 'hidden', 'name' => 'id', ), array( 'type' => 'select', 'lang' => true, 'label' => $this->l('Nom element'), 'name' => 'nom_element', 'options' => array( 'query' => $combo[0], 'id' => 'id_option', 'name' => 'name' ) ), array( 'type' => 'select', 'lang' => true, 'label' => $this->l('Nom element 2'), 'name' => 'nom_element', 'options' => array( 'query' => $combo[1], 'id' => 'id_option', 'name' => 'name' ) ), ), ), 'submit' => array( 'title' => $this->l('Save'), 'name' => $this->l('update'), ) ), ); Html output : <select> <option 1>banane</option> <option 2>pomme</option> </select> What I would like : <select> <option 1>banane</option> <option selected 2>pomme</option> </select> Thanks a lot, Xavier M 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