Friday, January 25, 2013

Re: Validating multiple fields problem

On Fri, Jan 25, 2013 at 4:04 PM, Michael Gaiser <mjgaiser@gmail.com> wrote:
> So, I have an event model that you are able to assign people to. Some events
> require at least 2 people to be assigned before they are considered valid. I
> have two fields for the user to filling in the persons name, and a custom
> validation rule that accesses $this->Event->data to loop through the
> different fields. This works great the first time through as the data is
> there, but it then fails a 2nd time (still within the same validation call)
> because $this->Event->data is now empty. So here are my questions:
>
> Is there a better way to get the data from the other fields in the Event
> form?
> Why is $this->Event->data being cleared midway through the validation rule?
> Why does the custom validation function get run twice, failing the 2nd time?
> Is there some flag I need to set to make the validation only run once?
> Can I access Session data from within my model?

I think it might be best if you posted some code.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.

No comments: