Welcome Guest, Not a member yet? Register   Sign In
Function set_value() not working as expected
#21

[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?
#22

[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.
#23

[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 Smile
#24

[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'); ?> />
Actually with jb' solution, it is
Code:
<input type="checkbox" name="mycheck[]" value="1" <?php echo set_checkbox('mycheck', '1'); ?> />
Same for radio, didn't try on <input type="text" name="mycheck[]" ... />.

Bye Smile
#25

[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/ .
#26

[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: &lt;input type="text" name="p_name" value="&lt;?php echo set_value('p_name'); ?&gt;" /&gt;&lt;/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
#27

[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)
    {
        return $this->set_value_array($field, $value, ' selected="selected"', $default);
    }
[/quote]

Thanks for that fix! Just one little correction, the set_radio function should use ' checked="checked"' instead of ' selected="selected"'.
#28

[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.
#29

[eluser]Unknown[/eluser]
Thanks a lot jbreitweiser ! :-)
#30

[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




Theme © iAndrew 2016 - Forum software by © MyBB