jsuissa
jsuissa

Reputation: 1762

Does Codeigniter's validation class support multiple forms on the same page?

Can anyone confirm that Codeigniter's validation class doesn't support multiple forms on the same page, especially when the forms share 'name' fields?

That seems to be the case from the posts I've read, just wondering if it is -- and if there are any ingenious workarounds? Much thanks.

Upvotes: 1

Views: 205

Answers (1)

landons
landons

Reputation: 9547

Ah, interesting issue. There's no way to derive directly from POST data which form submitted that information. Unless you "namespace" the field names, you're probably out of luck with multiple validated forms on the same page.

Another approach might be to store a hidden field specific to that form, and extend the Form_validation class to show errors related to that form only.

However, it would be much easier just to rename/namespace your fields. Probably more sustainable too.

Upvotes: 1

Related Questions