Wednesday, August 7, 2013

Error array

Is there a way to grab / view the errors from a form.

 

Let me explain.

My forms get sent ajax and all my forms are elements so when submitting a form all I need to update is the form itself, not the whole view.

JSON response success: function (response.html) in the scripting returns the form element back into its <div id="myFormHere">response html which is just the form element</div> with the errors on the form if any as normal.

 

But if there was a way to simply grab the errors collected from cake for the field and simply use the js to add the error class and message to the appropriate field that would be much easier.

There would be no need to return an element cutting back on the overhead.

 

Basically if there was a method to grab errors for each field something like this:

 

Errors = array(

                User = array(

                                Field = array(

                                                Name = city

                                                Message = Please enter your city

                                                )

                                )

                );

 

I could simply add the error message / class to each field.

Maybe there is a way already but I could not see anything other than the list of error messages.

 

Thanks guys,

 

Dave

 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate