Announcement Announcement Module
Collapse
No announcement yet.
Sorting results using simple form controller Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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?

    Thanks

  • #2
    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.

    Comment


    • #3
      Originally posted by jacobmattison View Post
      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.
      Thanks for the reply jacob. I was in fact posting to the servlet using javascript on the onclick event on the link. However, the html for the link looked some thing like this:
      <a href="" onclick="postBack()">sort</a>
      what this did was it posted back to the form twice once as a get to the form (because of href="") and once by the javascript post back. I changed the link to
      <a href="#" onclick="postBack()">sort</a>
      so there is only one request sent by the javascript that posts back to the server.

      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.

      Comment

      Working...
      X