form_validation - questions about set_value and set_rules - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: form_validation - questions about set_value and set_rules (/showthread.php?tid=22808) |
form_validation - questions about set_value and set_rules - El Forum - 09-21-2009 [eluser]überfuzz[/eluser] I have a question about the form_validation class. In the following example theres two fields. One with some rules attached to it and one field with no rules. Code: $this->form_validation->set_rules('name', 'Name', 'required|min_length[2]|max_length[40]'); And in the form I'm setting values like this: Code: <?php echo form_input('name', set_value('name')); ?> However, I deleted the line with example because there where no rules, no need setting it then was the idea. But if I delete it the value isn't stored , value="[empty]", if the user fires the form submit. Is there an other way of passing the input in a field with no rules inserted by the user? Or should I always have rules to every field like; min_lenght, max_length etc? form_validation - questions about set_value and set_rules - El Forum - 10-02-2009 [eluser]HobbesTheTiger[/eluser] I'm wondering the same thing. And I found a report in the bug tracker: http://codeigniter.com/bug_tracker/bug/7910/ [quote author="überfuzz" date="1253542178"] Is there an other way of passing the input in a field with no rules inserted by the user? [/quote] form_validation - questions about set_value and set_rules - El Forum - 10-02-2009 [eluser]rogierb[/eluser] If you want to use set_value(), then you need to let the form validation class know a fields exists. When Ik don't need a rule, I use either "trim" or a custom rule the just spits out "true". form_validation - questions about set_value and set_rules - El Forum - 11-03-2009 [eluser]Unknown[/eluser] I use... Code: if ($_POST) Hope that helps. Greg |