I have a form that inclues checkbox data. The form includes error checking. So when someone fills out the form and forgets to fill in her name -- a required field -- she gets the form redisplayed with the "Enter Your Name" text appearing in red font-face and directions to enter the missing data.
I've set the form up so that when there's an error the form field input is echoed back into the appropriate form fields and this works great on textarea and textbox input and for radio buttons. But for checkbox data I'm having a problem.
When you are first adding a record, the checkboxes are empty. If you check them off and submit the form but get an error message, the checkboxes come back up empty even if you've filled them in.
If you are coming back later to edit the record and you saved the record the last time with some checkboxes filled in, if you get the error message during your editing the checkboxes default back to the saved data.
What would be the best way to get that checkbox input to appear correctly in the form after encountering an error message? I am thinking that I could create a second database table that captures the checkbox input upon each submit and then gets saved to the final table when a submit goes through with no errors? Appreciate any suggestions!