form_validation - questions about set_value and set_rules |
[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?
[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]
[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".
[eluser]Unknown[/eluser]
I use... Code: if ($_POST) Hope that helps. Greg |
Welcome Guest, Not a member yet? Register Sign In |