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?
Watch
GitHub Core
Show your support for Zikula! Sign up at Github account and watch the Core project!
GitHub Modules
- rgasch created topic »Using PageUtil::addVar() to load script code« 11:48 AM
- michiel responded to »password problem« 10:01 AM
- mazdev responded to »Hide "Register new account" and change template to 3 col« 07:50 AM
- mesteele101 created topic »Zikula 1.3.3 - Site Search 1.5.2 - Unable to turn off plug-ins« 07:48 AM
- mesteele101 responded to »ERR (3): E_USER_ERROR: Smarty error: [in pagesvar:pagesitem2en line XXX]…« 25. May
- mazdev responded to »Pages 2.5.0 and updating - Page not found« 25. May
- mesteele101 responded to »Zikula 1.3.3 - Selecting a category in Pages not working« 25. May
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
pnForm "results"
-
- Rank: Helper
- Registered: Dec 31, 1969
- Last visit: May 07, 2010
- Posts: 507
-
- Rank: Developer
- Registered: Jun 03, 2002
- Last visit: Dec 21, 2009
- Posts: 284
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. -
- Rank: Helper
- Registered: Dec 31, 1969
- Last visit: May 07, 2010
- Posts: 507
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... -
- Rank: Developer
- Registered: Jun 03, 2002
- Last visit: Dec 21, 2009
- Posts: 284
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. -
- Rank: Developer
- Registered: Jun 03, 2002
- Last visit: Dec 21, 2009
- Posts: 284
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.
- Moderated by:
- Support
