Welcome Guest, Not a member yet? Register   Sign In
Using callbacks from a model

I was reading the user docs for callback method on form validation. Is there a way to do the callback from a function the lives within a model instead of within the controller itself.

The short answer is probably not. You could be able to pass the data object back to the model and do the callback validation from there.

However, why would you want to. The model shold be used to get the data from a source or save it back to the database. If you could have already validated it before you got it, then why didn't you (and therefore save a callback)

What you could do is define within the model the callback validation that should be run against a particular piece of data and use that to populate the callback functionality in the controller.

In other words. The model should tell the controller what callbacks to perform, but the controller should still run them.


You could always use native PHP callbacks if you want

Theme © iAndrew 2016 - Forum software by © MyBB