[eluser]Maglok[/eluser]
I have done some digging around on the forum and found several cases of problems with checkboxes. Nothing that really solves my problem though.
Basically I am adding form validation to a form. Part of the form is a checkbox, 1 checkbox with either a true or false value.
The view looked kinda like this:
Code:
<p><label for="inschrijving_open">Inschrijvingen open</label><?php echo form_checkbox('inschrijving_open', TRUE, $inschrijving_open); ?></p>
This worked just fine. This was for the edit view, the add view would have had a FALSE at the place of $inschrijving_open.
Now I tried to add validation. I can do textareas or dates or whatever, and callbacks even. I just can't get the checkbox to work. What I understand from the user_guide it should look sort of like this:
Code:
<p><label for="inschrijving_open">Inschrijvingen open</label><?php echo form_checkbox('inschrijving_open', set_checkbox('inschrijving_open', 'true')); ?></p>
What I want it to do is just repopulate if other fields in the form are required and then not filled out. I also want it to display the value in the database first time it is loaded. But here is the killer
I also need it to remember if it was changed since it was loaded from the database.
I can better illustrate it using a text example. Let's say the database has 'Example 1'. That value is set to a field. Then someone comes along and changes it to 'Example 2'. He then submits the form, but forgot to fill out a required field. The form reloads and would get the old value from the database ('Example 1'), but it should remember to repopulate using 'Example 2'.
This has got me quite stumped.