Fork me on GitHub

pnForm "results"  Bottom

  • I need to make an "advanced search" form for one of our internal modules. Visitors need to be able to search on about a dozen text fields and select options from 2 multiple lists. I've been using pnForm for most of my forms, so I continued along that path.

    I now have the form "working", as far as taking input and selecting data to display in the results, and now I've hit a wall. At least in my understanding of pnForm, if not pnForm itself. Up until now, once pnForm does it's thing, I just redirect to another URL and give it a few parameters. That's not practical here. The result set could be hundreds of records, and the query could be very very long with multiple joins. What do I do? I've searched for exampled that do more than the URL & parameters thing in other modules I have installed, but don't see anything more sophisticated.

    Am I trying to do something pnForm wasn't designed for?
  • All the pnForms I've used/created, the form handler takes the values and saves/deletes from the database; then redirects to the view page. Sounds like what you want to do is instead of the form handler doing database calls; take the data gathered by the form and pass those values to the search result page and let the search result page handle the database search instead of the form handler.



    edited by: cyber_wolf, datetimebrief

    --
    cyber_wolf
    www.bkbsolutions.com - My Zikula module development site.
  • I see what you're saying. That could potentially be a really long query string to pass to the next page, or I guess data embedded in hidden fields to be used in a new form.

    One alternative I thought of over the weekend would be to save the query string into a table and recall it from the database via the URL redirect. You could then add the limit and offset to it for paging purposes.

    Hmm...
  • You don't pass the search string. You pass the array of values that was collected. In your form handler, you have

    Code

    $Data = $render->pnFormGetValues();


    Then instead of building the string here, pass those values onto the search results page

    Code

    $returnUrl = pnModUrl('module', 'type', 'function', $Data);


    Then in your search results page, build the query string.

    --
    cyber_wolf
    www.bkbsolutions.com - My Zikula module development site.
  • Or store the array of values (or the search string) into a session variable in the form handler, go to the search results page, then read get the values from the session variable and build the search string (or read the search string).

    --
    cyber_wolf
    www.bkbsolutions.com - My Zikula module development site.

This list is based on users active over the last 60 minutes.