Oct 4th, 2008, 05:22 PM
Sorting results using simple form controller
I am using a simple form controller to allow users to search for data that gets displayed in the SimpleFormController's success view. I would like to add sorting capability to the search results. For this I created a sort link and I post back to the form where I display the results. However, SimpleFormController forwards the request to the formView instead of calling onsubmit and redisplaying the success view. Any ideas how I can modify this behaviour?
Oct 4th, 2008, 08:08 PM
When you say you "created a sort link" and that you "post back to the form", I assume this is a regular link (i.e. a GET request) with a querystring representing the sort value?
If so, it's not seeing it as a submit (and calling onSubmit) because it's not a form POST request. To deal with this, you override isFormSubmission, have it look for the querystring you're using, and return true (thus triggering the call to onSubmit) if it's there.
Oct 5th, 2008, 12:47 PM
Originally Posted by jacobmattison
<a href="" onclick="postBack()">sort</a>
<a href="#" onclick="postBack()">sort</a>
Your idea is also valid I could examine the request parameters and override isFormSubmission to return true when appropriate. Thanks for your response, it steered me in the right direction.