In my application I use an edit form with checkboxes. There
are two levels for the checkboxes, a Category and Subcategories for
each Category. When the user submits the form, i need to compare
what is currently in the database against what was submitted. If a
Subcategory within a Category was deselected by the user, I need to
remove the corresponding record from the DB. If a Category was
deselected, I need to remove all the corresponding records for the
Category from the DB. If a Category not previously selected has
been checked then I need to insert a new record and the same if a
Category and Subcategory were checked. There is no restriction that
both a Category and at least one Subcategory be selected. The user
can simply select a Category and no Subcategorie.
I have queried the DB for the current information, stored the
results in an array and then converted the array to a list. The DB
list is in the form Category, Subcategory. The information from the
form is already in list form as Category, Subcategory. I am having
a devil of a time figuring out the logic to find the differences
and take the appropriate action. Has anyone worked on a similar
project and can offer some advice?
Thanks,
Warren