Form validation validate two dependent fields |
[eluser]mjsilva[/eluser]
Hi there, I've step into a problem using Validation class, I'm building a role access base application and I divided Roles in two groups Module and Action. When I was building the form to add a new Role I added two input boxes, one for Module and other for Action. The thing is that I need to make sure that the conjunction of the two don't exists already in the DB. Code example: Code: class Roles extends Controller { Now I need to validate against the DB if module AND action already exists. Only when they exists together I don't want to insert another records, eg: Code: Role 1: If I try to insert another: Code: $module = 'clients'; Can this be done with form validation class or do I have to come up with a different approach? Thanks, MJS
[eluser]davidbehler[/eluser]
Maybe this thread helps: http://ellislab.com/forums/viewthread/123810/
[eluser]mjsilva[/eluser]
Thanks a lot waldmeister for the quick answer! Didn't know it was possible to pass a second argument in a rule! Cheers! |
Welcome Guest, Not a member yet? Register Sign In |