Welcome Guest, Not a member yet? Register   Sign In
Repopulate a Dropdown
#6

[eluser]Lawrence Leung[/eluser]
[quote author="Jamie Rumbelow" date="1276033695"]Use the set_select() function in the form validation library. Read the docs on it - it's a really useful little function.[/quote]

I am not sure how to use the "set_select" which mentioned in the document. In the documentation, it used the "set_select" to the "options" one by one. But in the form_dropdown, I passed an array to it. Therefore, I don't understand how to apply the "set_select" in it.

I used $this->input->post('xxxxxxx') to re-populate the dropdown form.

e.g.

<?php echo form_dropdown('article_material', $material_options, $this->input->post('article_material'), 'id="article_material"'); ?>

When it is in a update form, which required a default value:

<?php echo form_dropdown('article_material', $material_options, $this->input->post('article_material') ? $this->input->post('article_material') : $article['article_material'], 'id="article_material"'); ?>


Messages In This Thread
Repopulate a Dropdown - by El Forum - 06-08-2010, 08:54 AM
Repopulate a Dropdown - by El Forum - 06-08-2010, 10:17 AM
Repopulate a Dropdown - by El Forum - 06-08-2010, 10:31 AM
Repopulate a Dropdown - by El Forum - 06-08-2010, 10:48 AM
Repopulate a Dropdown - by El Forum - 06-08-2010, 11:39 AM
Repopulate a Dropdown - by El Forum - 02-08-2011, 07:47 PM
Repopulate a Dropdown - by El Forum - 06-20-2011, 04:26 PM



Theme © iAndrew 2016 - Forum software by © MyBB