CodeIgniter Forums
Coding Approach Question - (Validation?) - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: Coding Approach Question - (Validation?) (/showthread.php?tid=14725)

Coding Approach Question - (Validation?) - El Forum - 01-13-2009

Hello all,

I'm currently trying to figure out how to do something but I have no idea how.

Here is what I am trying to do. I have a form where you can dynamically add groups of form fields via jQuery. Like this:

-- Before (img)

-- After (img)

So you don't add just one input, you add a group.

Now here is my question:

While actually filling out one of the field groups is optional, if you choose to use one, you must fill out all fields in that group.

How can I check for this? I currently have all the inputs in a field group set to arrays. I was thinking of maybe doing a count() of all the input arrays and then finding out the max() to see how many groups were actually added or something like that. How would I find out that the person only filled half of one of the groups or something? I don't want people only partially filling out neither would I like to have tampered forms being passed over.

Im guessing validation would be kinda hard for this as well?

Thanks in advance for your help. I really need assistance with this.