0
votes

I must be missing something simple here. I am using beforeSave in CakePHP to run some tests on the data before its saved. If beforeSave returns true, the data is saved and the user is redirected. If beforeSave returns false, I would like to NOT redirect the user - but rather just display a Session->setFlash with instructions on how to correct the problem.

This works the first time "Submit" is clicked, however subsequent Submissions do nothing. If I refresh the page it works fine, if I add a redirect back to the same page on the Controller it works, but I'd like to avoid emptying all the entries on the form (or having to devise some other way to fill it back out for them).

Is there some hidden variable, Session ID or something that must be reset?

Thanks!

1
can you paste the code from beforesave and the code from the controller?cornelb
I stripped my code down to the most basic If statements inside the beforeSsave with no luck, so I am guess it has more to do with not refreshing the page than the beforeSave function itself. For example, I could remove the redirect from a generic baked "add" and it would only allow you to add one record without refreshing.esjay

1 Answers

0
votes

I think my overall logic was flawed, too much time thinking about it... I basically need to submit a form multiple times without refreshing the page, which really has nothing to do with CakePHP specifically and is more of an Ajax question. Does that sound accurate?