Welcome Guest, Not a member yet? Register   Sign In
Creative Use of Callbacks for Form Validation
#1

[eluser]Ashes-to-Ashes[/eluser]
I have code that runs after user submits form, to rewrite fields before sending them to the database. I could probably just check during this 'post process phase' to make sure everything rewrites effectively before attempting to write to the database, but I saw the callback feature and am trying to see if that would allow me to use more of the CI functionality.

I have two problems: I have one large controller divided into several libraries. The callbacks all have to go into the controller from what I can tell, this makes my chosen organization not work very well.

Second problem, is when I return a value from the callback besides TRUE (rewritten value), it does not change the form data it appears.

#2

[eluser]skunkbad[/eluser]
You can put your callbacks in models. There are a couple of solutions that you will find in this forum, one of which I wrote.

Instead of returning TRUE, return the processed value. Easy stuff...




Theme © iAndrew 2016 - Forum software by © MyBB