How do you perform Form validation without a model in Cakephp?

后端 未结 6 974
Happy的楠姐
Happy的楠姐 2021-02-13 00:06

I need to perform some validation. I don\'t have the model in the application.

Does anyone know how to do the validation without a model? Can you show me using a small s

6条回答
  •  余生分开走
    2021-02-13 00:43

    Came across this question since I also had a similar issue. I have a form that needs to collect data and generate a PDF. So there is no data saving involved nor there is a maching model class. The PDF is a user contract and the user will fill the online form and the data filled will be used to generate the PDF which they must print and mail back. But I need to validate whether the fields are not empty, whether email is really an email format, and date inputs are really date inputs.

    First I did without a model class then saw this quesion. Now I'm using a dummy model class to have my validations put in there since the code in controller action looks much neat.

提交回复
热议问题