Would this work? |
[eluser]IamPrototype[/eluser]
Hey. I started up a project myself. I'd like to create a mini community (traning, training...). So far I've coded my auth library and auth model or at least some if it. I coded it in a way so my controller sends some data to the library and my library connects to my model and then back to my library and back to my controller. You see? Sorry, english isn't my native language. What I'd like know is: Would form validation work that work? Some code from my library, a function named register Code: function register($register = NULL) That function, register, will connect to my model. Some code from my model, a process function named process_register Code: function process_register($register) Then in my controller I'd do it like this. Code: if ($this->Auth->register($register_array)) Would that work out? Or would my validation lose its validation errors because it's going through a library and a model? Just curious!
[eluser]slowgary[/eluser]
Try it and see. Let us know while you're at it. Thanks.
[eluser]IamPrototype[/eluser]
Just curious because form validation normally are placed in the controller, right?
[eluser]Dam1an[/eluser]
Of the Authentication libraries I've seen, the validation takes place in the library, not the controller
[eluser]TheFuzzy0ne[/eluser]
I don't think it will work, although it's certainly possible - http://codeigniter.com/wiki/MY_Validatio...to_Models/. Personally, I feel it makes more sense to keep the validation rules and the running of the validation process in the controller methods, not the model.
[eluser]IamPrototype[/eluser]
I think it makes more sense to keep them in the controller too, oh well, I'll re-code.
[eluser]Thorpe Obazee[/eluser]
Others may say that validation doesn't belong in the controller I guess it depends on the coder :p
[eluser]IamPrototype[/eluser]
Yes, but I guess it would be easiest to put it in the controller as I used to do. Just thought that the code I posted up there would be easier. |
Welcome Guest, Not a member yet? Register Sign In |