![]() |
Repopulate select menus in 1.7 - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Repopulate select menus in 1.7 (/showthread.php?tid=12981) |
Repopulate select menus in 1.7 - El Forum - 11-06-2008 [eluser]Sander Versluys[/eluser] I've searched the forums and it's been asked before but since 1.7 the validation library has changed, I can't get it to work. Code: <select name="myselect"> This code is from the docs. I do not understand how the function can know which option to select. Can somebody explain this to me...? Here's an example of what I'm trying todo: Code: <select name="level"> In my controller I pass the object $user, wich has the property 'level', to the view. The option with the same level as in the object should be selected. Any help would be greatly appreciated! Thanks! Repopulate select menus in 1.7 - El Forum - 11-06-2008 [eluser]crumpet[/eluser] it compares the it to the data $this->_field_data[$field]['postdata'] which is a variable the validation class sets. What you have done should work...if you are using the rest of the validation library Repopulate select menus in 1.7 - El Forum - 11-06-2008 [eluser]Sander Versluys[/eluser] Thanks for the info! Still, i can't seem to get it to work although i use the validation library as described in de docs. But offcours i know there must be on error on my side somewhere. I used the form_dropdown() function from the form helper and that did the trick for me... Repopulate select menus in 1.7 - El Forum - 11-07-2008 [eluser]McNoggin[/eluser] Did you have a rule setup for level? If not then it won't work. |