Welcome Guest, Not a member yet? Register   Sign In
set_value doesn't repopulate unless field rule exists.
#1

[eluser]bretticus[/eluser]
I did jump into the core code a little bit but to save me some time...does anybody know if it's true that I can't use set_value() to get the post value of a particular field that is not defined with a rule ($this->form_validation->set_rules...?) My testing and following the core code seem to affirm my suspicion. Is this by design? I mean, this is an easy "roll-your-own" but just seems strange to me.
#2

[eluser]CroNiX[/eluser]
Yes its by design. Just make a simple rule. Something like $this->form_validation->set_rules('fieldname', '', 'trim');
#3

[eluser]bretticus[/eluser]
Yeah, I was looking for a "optional" or something but I also thought a trim would do the trick. So I actually did that just a min or two ago (glad you confirmed my thought process.) I was going to make a helper function, but I'd rather control whether the field becomes required (probably never will be) in the controller in the future and not have to change convention for designers.

Thanks for the reply.

EDIT:

I should mention. Just experimenting, adding a rule with just the input name seems to do the trick also...

Code:
$this->form_validation->set_rules('referredby');




Theme © iAndrew 2016 - Forum software by © MyBB