PDA

View Full Version : SimpleFormController::processFormSubmission vs. SimpleFormController::onSubmit


tiago182
Feb 10th, 2006, 11:18 AM
Hello,

What's the difference between the methods SimpleFormController :: processFormSubmission() and SimpleFormController :: onSubmit()? I mean, I have 2 distinct controllers, and one of them simply doesn't call onSubmit(). That's the reason I'm using processFormSubmission(), but I don't like the idea of guessing the method will be called every time I build a new controller.

Regards,

Colin Yates
Feb 10th, 2006, 11:28 AM
processFormSubmission is a facade (excuse the misuse of the word) that will do a number of things; bind the parameters onto your form, do any validation and if there are no errors; call onSubmit.

To put it another way; SFC cares about processFormSubmission; you care about onSubmit :)

tiago182
Feb 10th, 2006, 11:41 AM
Thanks for replying Yatesco. But I'm still wondering why for some cases the callback method onSubmit() isn't being called... do you have a clue?

Colin Yates
Feb 10th, 2006, 01:57 PM
Thanks for replying Yatesco. But I'm still wondering why for some cases the callback method onSubmit() isn't being called... do you have a clue?
Probably validation errors or binding errors.

Step through processFormSubmission and see what is happening...

tiago182
Feb 14th, 2006, 08:54 AM
That was the issue, I had validation errors and the onSubmit() method wasn't being reached. Thanks!