Saturday, January 29, 2011

Re: Universal search form validation using a fake model

On Sat, Jan 29, 2011 at 3:50 AM, digitalw00t <digitalw00t@gmail.com> wrote:
> Models:
> Vehicles hasMany Doors, Wheels
>        Actions:  index, search, view, add, edit, delete
> Doors           belongsTo Vehicles
> Wheels          belongsTo Vehicles
> Customers       hasMany Vehicles
>
> urls:
> vehicles/index - list all vehicles for the past 2 weeks
> vehicles/search - list only the vehicles based off the form in the
> search view, but should display the records in the vehicle.index view
>
> Search form Validation:
> Doors can be no more than 4 and must be a positive number
> Wheels cannot be greater than 16 but must be a positive number
> Customer must have at least 4 characters
>
> My initial thoughts are to create a fake search model to do the search
> view's form validation.  This would insure that the form data was of a
> nature that wouldn't cause undue stress on the database.  Any ideas?

Not sure what your question is. In any case, wouldn't it be better to
have doors & wheels to be columns in the vehicles table, rather than
associated models?

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: