Login | Sign up | Toll-Free: 1-800-752-0455
 
 

Forum

 

7 posts by 3 authors in: Forums > CMS Builder
Last Post: September 28, 2017

Hi All.

I have a field list called "type" and in the CMSB > section > searching I want to be able to find multiple types.  I've tried using Type | type | query, however as the field is a list, it give me a drop-down rather than a text field.

ie.  I want to find a reservation that is not "wedding", so I should be able to search for " - wedding"?

Or.  I need to be able to "multi-select" so I can choose multiple types (the types that are not wedding)

Any ideas?

Cheers,

Tim Forrest
Toledoh Enterprises
www.toledoh.com.au

Apologies for jumping in on this thread with an unrelated question.

I have a client in Australia that is looking for a reputable host provider. He currently uses crazy domains whose service, in his experience is unreliable.  Toledoh, I notice you are in Australia, can you recommend anyone.

Sorry again for jumping in. I looked but I don't think you can send a direct message to other users on this forum, and assumed you would probably be following your own question!

Sure thing. Send me an email tim@toledoh.com.au. 

Cheers,

Tim Forrest
Toledoh Enterprises
www.toledoh.com.au

Hi Tim, 

Under: CMS Setup > Section Editors > Your Section > Searching (tab)

You can create a multi-value pulldown by adding [] after the fieldname, eg: 

Label Text|fieldname[]|match

And I think you're right that "query" type searches should show as a text field.  Try this patch in: /lib/menus/default/list_functions.php

Search for: b_all and REMOVE the line in red: 

    if (preg_match("/\b_all_\b/i", $fieldsAsCSV)) { $fieldsAsCSV = __getAllSearchableFieldsAsCSV($schema); }
    if (!$searchType) { $searchType = 'query'; }

Then add the code in BLUE

    // figure out "displayAs" search field type
    if (!$displayAs) {
      $displayAs = 'textfield'; // default search field type

      if (count($fieldnames) == 1 && in_array($searchType, ['', 'match'])) { // if single field
        $fieldName   = $fieldnames[0];
        $fieldSchema = @$schema[ trim($fieldName, '[]') ];
        if      ($fieldName           == 'hidden')   { $displayAs = 'checkbox'; }
        else if ($fieldSchema['type'] == 'checkbox') { $displayAs = 'checkbox'; }
        else if ($fieldSchema['type'] == 'list')     { $displayAs = 'dropdown'; }
      }
    }

    //
    if (!$searchType) { $searchType = 'query'; }
    $searchRows[] = array($label, $fieldnames, $displayAs, $searchType);

Once you do that you should get a search field with this that allows you to do -not -this searches.

Label Text|fieldname|query

Let me know if that works for you!

Dave Edis - Senior Developer
interactivetools.com

Thanks Dave.

That Multi-select works great.  I'll try the patch shortly.

Cheers,

Tim Forrest
Toledoh Enterprises
www.toledoh.com.au

Hmm, yea that is the way they're stored.  We'd have to do some more work to be able to search on the labels.

Dave Edis - Senior Developer
interactivetools.com