CodeIgniter Forums
set_value() not working for hidden fields? - 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: set_value() not working for hidden fields? (/showthread.php?tid=41702)



set_value() not working for hidden fields? - El Forum - 05-14-2011

[eluser]Sein Kraft[/eluser]
For some reason this line keeps setting '1' instead '0' like the set_value says.

Code:
echo '<input name="category" type="hidden" value="'.set_value('category', '0').'" />';



set_value() not working for hidden fields? - El Forum - 05-14-2011

[eluser]darrentaytay[/eluser]
Set value requires that you have CI's Form Validation set up for that field - do you have form validation on category?


set_value() not working for hidden fields? - El Forum - 05-14-2011

[eluser]Sein Kraft[/eluser]
[quote author="darrentaytay" date="1305432037"]Set value requires that you have CI's Form Validation set up for that field - do you have form validation on category?[/quote]

Yes, I did.

Code:
$this->form_validation->set_rules('category', 'category', 'trim|required|is_natural');



set_value() not working for hidden fields? - El Forum - 05-14-2011

[eluser]InsiteFX[/eluser]
You riles are wrong!
The secod category should be upper case...
Code:
$this->form_validation->set_rules('category', 'Category', 'trim|required|is_natural');

InsiteFX


set_value() not working for hidden fields? - El Forum - 05-15-2011

[eluser]Sein Kraft[/eluser]
[quote author="InsiteFX" date="1305456460"]You riles are wrong!
The secod category should be upper case...
Code:
$this->form_validation->set_rules('category', 'Category', 'trim|required|is_natural');

InsiteFX[/quote]
PFffffff!!!

My rules aren't wrong. Why people don't read the doncumentation before appear screaming and saying that everything is wrong because it isn't in upper case...

The second argument will be passed as text in the error message to be interpreted by the final user.

User Guide


set_value() not working for hidden fields? - El Forum - 05-15-2011

[eluser]darrentaytay[/eluser]
Yeh you're right, the second parameter is just a label the users see.

Can you post more of the code so we can try and understand the problem a bit better please?