Private function and Custom form validation |
[eluser]BenAbrams[/eluser]
Hi Guys I have a custom field validation rule in a config file set up, something similar to to the below: Code: array( A very simple function in my controller below just checks the input and provides a custom error message Code: public function check_terms($terms=0){ I wanted to make the function above 'private' so it couldn't be accessed by the URI but obviously this prevents the helper from accessing the function. I cant add the underscore to the function name because the callback doesn't seem to accept it. I was thinking of using the _remap function to send 'check_terms' in the uri to the 404 but this seems a little overkill. Can anyone suggest a more elegant solution?
[eluser]CroNiX[/eluser]
Yes, http://ellislab.com/codeigniter/user-gui...ml#private Code: function _check_terms(){} Since callback prefixes are "callback_", and the private function is "_check_terms", it ends up being "callback__check_terms" with 2 undrescores
[eluser]CroNiX[/eluser]
I don't think he called the callback correctly, but he didn't post enough code to really know...
[eluser]InsiteFX[/eluser]
I think your right CroNiX, looks like the old double underscore problem again.
[eluser]BenAbrams[/eluser]
If I double underscore, instead of showing my custom message, it shows "Unable to access an error message corresponding to your field name."
[eluser]CroNiX[/eluser]
Did you change the name of your error message to "_check_terms" since you changed the function name? They have to be the same.
[eluser]BenAbrams[/eluser]
[quote author="CroNiX" date="1341766629"]Did you change name of your error message to "_check_terms" since you changed the function name? They have to be the same.[/quote] I did indeed.
[eluser]InsiteFX[/eluser]
Code: array( Code: public function _check_terms($terms=0){ |
Welcome Guest, Not a member yet? Register Sign In |