Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder:
Listing ALL records after search

 

 


webgfx
User

Dec 27, 2011, 8:48 AM

Post #1 of 4 (388 views)
Shortcut
Listing ALL records after search Can't Post

I am trying to create a page that has a search form on it to search records (listings) on a CMS Builder powered realty website. Everything works great except for one thing. My dropdowns are auto-populated from fields in the "listings" DB table. The problem is that after a search, the page (which still has a search form on the left side of the page) now only shows the drop down values that pertain to the result returned from the previous search.

I want ALL applicable field records to be shown in the search form drop down menus ALWAYS, regardless of a previous search. For example, there is a "county" dropdown field that should always show all unique counties from that exist in the current listings. As I said, it works great until you perform the first search, then the dropdowns narrow themselves so that they are pulled from the set of the returned results.

How do I force what I am wanting without messing up the returned results that should be shown to the viewer normally?

Thanks,
Keith D Sellars
WebGraffix Media Solutions, LLC
http://www.webgraffix.com


Tom P
User


Dec 27, 2011, 11:48 AM

Post #2 of 4 (380 views)
Shortcut
Re: [webgfx] Listing ALL records after search [In reply to] Can't Post

Hello Keith,

One solution would be to copy the 'list' call (that is currently being used to run the page), rename the variables that it uses and add 'allowSearch'=>false to the array of options (see below for an example).

Once you've done that, use the data from this new set of variables to drive your drop down menu.

Current getRecords call (example):

Code
list($records, $recordsMetaData) => getRecords(array( 
'tableName' => table,
'perPage' => 10,
));


Copied and updated to:


Code
list($recordsTwo, $recordsTwoMetaData) => getRecords(array( 
'tableName' => table,
'allowSearch' => false,
'loadCreatedBy' => false,
'loadUploads' => false,
));


Since the new 'list' call is being used to generate a menu, you don't need to include the createdBy information or any uploads for those records (unless you have photos or documents that you want to be able to access). Setting allowSearch to false means the search variables passed in the url won't affect the retrieval of the records (ie ALL records will be loaded).

Hope this helps,

Tom


webgfx
User

Dec 27, 2011, 12:08 PM

Post #3 of 4 (376 views)
Shortcut
Re: [Tom P] Listing ALL records after search [In reply to] Can't Post

Thanks, Tom. Works Great!

I actually had done exactly what you suggested earlier except that I had not added the allowSearch parameter and set it to "false". That was all that I was missing.

Here is what I wound up adding:


Code
  list($listingDDRecords, $listingDDDetails) = getRecords(array( 
'tableName' => 'listings',
'allowSearch' => false,
'loadCreatedBy' => false,
'loadUploads' => false,
));


The critical part is the allowSearch parameter! Thanks for replying to my post so quickly. I should be launching their site very soon. It's really coming together nicely.
Thanks,
Keith D Sellars
WebGraffix Media Solutions, LLC
http://www.webgraffix.com


Tom P
User


Dec 27, 2011, 12:11 PM

Post #4 of 4 (374 views)
Shortcut
Re: [webgfx] Listing ALL records after search [In reply to] Can't Post

Hi Keith,

Glad it worked for you!

For a full list of options for viewers, check out http://www.interactivetools.com/docs/cmsbuilder/viewer_options.html.

Good luck with the launch,

Tom