Welcome Guest, Not a member yet? Register   Sign In
Checkboxes, checked by default, how to ?
#4

[eluser]jgsd[/eluser]
The problem is that $this->validation->run() returns FALSE both if the validation didn't succeed and if the form is loaded for the first time. This is obviously the correct behavior for this call.

So, what we need is a way to distinguish whether or not the form has been submitted yet. If it has, we can have 'checked="checked"' appended by default but, if it has, we can let it use the value from $this->validation->set_checkbox('alow_pub', '1');

Trouble is, I'm not sure how to do this. :down: We can't check for $this->input->post('alow_pub') because, again, it has the same state both when the checkbox hasn't been checked and when the form hasn't been submitted.

If you figure this out by yourself, please post here as I would like to know, too!


Messages In This Thread
Checkboxes, checked by default, how to ? - by El Forum - 07-20-2007, 10:16 AM
Checkboxes, checked by default, how to ? - by El Forum - 07-20-2007, 10:30 AM
Checkboxes, checked by default, how to ? - by El Forum - 07-20-2007, 10:50 AM
Checkboxes, checked by default, how to ? - by El Forum - 07-20-2007, 07:53 PM
Checkboxes, checked by default, how to ? - by El Forum - 07-20-2007, 10:07 PM
Checkboxes, checked by default, how to ? - by El Forum - 07-21-2007, 02:00 AM
Checkboxes, checked by default, how to ? - by El Forum - 07-21-2007, 02:08 AM
Checkboxes, checked by default, how to ? - by El Forum - 07-21-2007, 08:18 AM
Checkboxes, checked by default, how to ? - by El Forum - 07-23-2007, 05:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB