Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable the display of validation errors in view (Cakephp)

I have a view which is containing 5 forms submitting separately but to the same model. The aim of this is allow the user to fill all the forms in the same page and be able to quickly compare the values he puts in for each form. Each form has most of the fields in common with another one. If you want a idea of the stuff, imagine that you are a soccer trainer and you want to be able on the same page to set up your team tactics for each half time. So I'll have a HalfTime model with two forms on the same page, one for each half time

So when I submit Halftime 1 form and that the validation fails, the validation errors of HalfTime1 is displayed in HalfTime2 fields too. I would like to be able to disable the validation of one form according if it wasn't submited.

My idea was to send a variable from the controller to the view containing the name/id of the current half time and from this variable, displaying validation errors only in the ccorrect form.

Do you have any idea on how I can disable the display of the validation errors in one field?

Thank you a lot!

like image 840
Thrax Avatar asked Jun 05 '11 14:06

Thrax


1 Answers

Set the error option to false when you use form input. ie:

echo $this->input('Halftime2.title', array('error' => false));
like image 200
Tyler Avatar answered Sep 26 '22 19:09

Tyler