CodeIgniter Forums

Full Version: Input filtering and Form validation
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I think that we have to create, new solution for Form validation and filtering.
At the moment Controllers take a huge amount of code only for validating forms which is not very right. 

Currently at other frameworks there are solutions as FormTypes/FormRequests/.. class's which are extended for each form there is and they are configurable. Setting validation rules and filtering and other related things as error messages. The combination of filtering + validation will remove the need of devs to validate anything inside the controllers.  
Once defined such class can be auto validated with our build in Validation library as it is now, and inside Controllers there will be just 1 initialization of this form validation.
This is very easily done by creating your own library
(04-06-2015, 10:53 PM)albertleao Wrote: [ -> ]This is very easily done by creating your own library

With your logic I can write my own framework as well..

This forum is to discuss future ideas..
(04-06-2015, 11:32 PM)sv3tli0 Wrote: [ -> ]
(04-06-2015, 10:53 PM)albertleao Wrote: [ -> ]This is very easily done by creating your own library

With your logic I can write my own framework as well..

This forum is to discuss future ideas..

Sorry, I could have been more clear.

I just think that inputer filtering and form validation will be very application dependent.
Our current input filtering and validation system does work...  That said, it could be made less intimidating and easier to use.  This could be helped by expanding and clarifying the sections in the User Guide (Great Document! but a work in progress).  I do not think a total re-write is needed.
I'm with albertleao on this one. CI is a set of building blocks to build your application the way you want. All we need for form validation is already available. I'm not saying it can't be improved, but it certainly not need to be rewritten from scratch. Also, in my opinion, creating a class for every form in an application is overkill.
(04-06-2015, 10:08 PM)sv3tli0 Wrote: [ -> ]I think that we have to create, new solution for Form validation and filtering.
At the moment Controllers take a huge amount of code only for validating forms which is not very right. 

i agree -- so put your form validation in a model  Cool
(and use an array for the validation rules versus writing it out line by line)
interesting. . So you think that filling controller with form rules and callback methods is right ?
What cartalog said...
Move it to the model.
(04-08-2015, 08:12 AM)sv3tli0 Wrote: [ -> ]interesting. . So you think that filling controller with form rules and callback methods is right ?

No, that will make for fat controllers. But like I suggested before. You could create a class for a form if you'd like and import that class. You could also push validation to the model.

Like IncludeBeer said before, the form validation in CI is pretty good right now. There could be some improvements (some additional rules would be nice), but you can already extend your form validation class for that. 
Pages: 1 2