Function set_value() not working as expected |
[eluser]JGarrido[/eluser]
[quote author="Tooker" date="1260783816"]Had this same problem using 1.7.2 and google took me here. This is still unresolved. Regards, Rob[/quote] Ditto. Has anyone been able to confirm if this has been resolved in the current build of v2 yet?
[eluser]Unknown[/eluser]
I've ran into this problem today and thanks to jbreitweiser for providing the fix. It would be good to this fix in the next update.
[eluser]morehawes[/eluser]
Thanks jbreitweiser for your fix! Worked for me (v1.7.2), though I would recommend extending the CI_Form_validation (MY_Form_validation) instead of replacing the functions ![]()
[eluser]dorwin[/eluser]
Hello, thanks for this, it work well. Little rectification : User guide give as example Code: <input type="checkbox" name="mycheck[]" value="1" <?php echo set_checkbox('mycheck[]', '1'); ?> /> Code: <input type="checkbox" name="mycheck[]" value="1" <?php echo set_checkbox('mycheck', '1'); ?> /> Bye ![]()
[eluser]webdevguy[/eluser]
[quote author="kandmcreative" date="1235519540"]I think we definitely need a solution where the array index is not needed, since often times, we don't know how many elements we will have.[/quote] There is a solution posted on this thread that just worked for me: http://ellislab.com/forums/viewthread/156497/ .
[eluser]Anes P.A[/eluser]
Hi pals, I am also Really Tired in this Super Bug . If we don't give a validation in a field, that field cannot populate with the set_value('field_name') as described in CI manuel. <p><label>Parent Name: <input type="text" name="p_name" value="<?php echo set_value('p_name'); ?>" /></p>, Pals any where and any body find a solution for same without Giving validation a field can repopulate. I am waiting your reply .... Regards Anes P.A
[eluser]Unknown[/eluser]
[quote author="jbreitweiser" date="1262468355"]Replace the set_value, set_select, set_radio, and set_checkbox in the /system/libraries/Form_validation.php file. Basically if the form validator does not have the value, the code checks the input class. Code: function set_radio($field = '', $value = '', $default = FALSE) Thanks for that fix! Just one little correction, the set_radio function should use ' checked="checked"' instead of ' selected="selected"'.
[eluser]kyleb[/eluser]
I used jbreitweiser's solution to this annoying problem and absolutely love it. I hope this change is merged into trunk soon.
[eluser]BrokenLegGuy[/eluser]
Thanks beachbum for bringing up this issue, found it via google search. I was ripping my hair out trying to figure out what the heck I was doing wrong. I read through the documentation a few times and nothing was mentioned that you had to have rules set of every field that you want to repopulate. A huge thank you to jbreitweiser for the super sweet fix. Thanks guys, Ed |
Welcome Guest, Not a member yet? Register Sign In |