Multi-field validation callbacks, the "login" form problem, etc. |
[eluser]marmida[/eluser]
[quote author="walesmd" date="1195109795"]I think these are pretty unique circumstances that all have a workaround (in this case). Nonetheless, if someone can find a graceful and easy to use solution - I'm sure it would be a welcome addition to the codebase.[/quote] This is neither as graceful nor as easy to use as I'd like, but here's the patch I hacked in: http://marmida.com/ci/ci_validation_glob...back.patch I loaded this by putting my modified Validation.php into the app's libraries/ dir, you don't have to actually overwrite the original one. From the controller's point of view: Code: $this->validation->set_fields(array( It'd be a lot nicer if this was had the interface of regular rules (e.g. $this->set_global_rules('rule_a|rule_b|callback__rule_c')) but there are some considerations with field name replacements to consider in the error messages that I don't have time to consider right now. Callbacks avoided this, since the callback is then responsible for setting the error message manually. |
Welcome Guest, Not a member yet? Register Sign In |