Form validation won't call the callback function |
[eluser]xarazar[/eluser]
Hi guys, I don't know what happened but I'm facing some bizarre behaviour of the form_validation class. The callback function in the code below simply doesn't work (it's not getting called). It's a simple MVC setup (not HMVC). Both methods are in the same class. I tried adding My_Form_validation like so: Code: class MY_Form_validation extends CI_Form_validation{ But in a simple MVC system I shouldn't be forced to do that, should I? Anybody any ideas? Many thanks
[eluser]Lucas Vasconcelos[/eluser]
i think you forgot to post your code... please, try to explain better what happens.
[eluser]InsiteFX[/eluser]
This has been answered many times on the forums! Use the forums search features. InsiteFX
[eluser]xarazar[/eluser]
Thanks. I expected this kind of answer. The truth is that I found only responses with regards to HMVC setups. My question was why I have to modify the Form_validation library in a simple MVC setup. I don't think it was dealt with in any of the posts but if I'm wrong I apologise. I read around 20 posts or so and none answered my question. The issue seems to have arisen with one of the latest releases of CI because I never had such a problem before. I guess I have to accept that the Form_validation library has to be modified and live with it. Shame...
[eluser]xarazar[/eluser]
@Lucas Vasconcelos Thanks mate. Yes indeed there's some code missing but this is really not the point. The problem is that my form validation callback doesn't trigger the callback function unless I modify Form_validation with the code I posted above. I built around a dozen of websites on CI and never had this problem. But for my recent development I downloaded the latest version and shazam! A little surprise. Never mind. Thanks for replying anyway.
[eluser]Lucas Vasconcelos[/eluser]
well, i'd a similar trouble using callback functions and fixed it using the code you posted. in my case, i was tring to put the validation rules at the model class, not the controller. see a snap of code: Code: class Sample_model extends MY_Model { note the $this argument passed to run() method of Form_validation class [that was extended ![]() i hope this works for you. see ya! |
Welcome Guest, Not a member yet? Register Sign In |