Jump to content
  • 0

Preselect multiple values to search in multi-select dropdown list


In a search datapage, with a list of cities available in a multi-select list box, how can I "pre-select" or set multiple values as the default search. Users want to see cities Bozeman, Belgrade, and Livingston as the default records returned in the default search results below the search form. The will then have the ability to change the selection using the multi select city field.

The values stored in the city field are a text field. Thanks for your ideas!

Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 1

Hello @wimtracking2,

As I understood from your inquiry, you store the cities in the field with the Text(255) data type and set this field on the Search page as Listbox -> Allow multiselection



And the Search is set like this:



If this is the case, it is possible to add the "selected" attribute to the options you want by JavaScript. 

I added this code to the Footer section on the "Search and Report Wizard - Configure Search Fields" page (the HTML editor is disabled on the Advanced tab before pasting). 


document.addEventListener('DataPageReady', selectedOptionHandler) 

function selectedOptionHandler() {

let firstCity = document.querySelector('#Value1_1 > option[value="Bozeman"]'); 
let secondCity = document.querySelector('#Value1_1 > option[value="Belgrade"]');
let thirdCity= document.querySelector('#Value1_1 > option[value="Livingston"]');

firstCity.selected = secondCity.selected  = thirdCity.selected = true;

document.removeEventListener('DataPageReady', selectedOptionHandler);


And here is the output. So, I can see the list of records where City is Bozeman, Belgrade, or Livingston on initial load.



In the example, the City field on the Search page is the only field and has the id Value1_1 that is used in the code above.

Basically, the second field on the Search has the id Value2_1, the third field - Value3_1, etc. Please replace the id in the code if needed. 

Hope this is the expected result and this solution helps.

Link to post
Share on other sites
  • 0

I don't think this is possible. Even if you are using List-String, and Multi-select form elements, the report will only show the records with the EXACT data you selected in the multiselect, it does not work as 'If any of the records has any of these values, show' 

You can create multiple criteria for one field. Each criteria can only hold one value, and the logic for all criteria would be OR. It's not dynamic though, so, you have to set a specific number of criteria.


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...