Jump to content
  • 0

Is It Possible To Create Select All And Deselect All Buttons On A Search Page?


Cameron

Question

Hi everyone!

 

I have a multi-select Listbox on my Search page.

The Listbox is very large, but sometimes users want to select all options. And deselct too.

 

Is it possible to create Select All and Deselect all buttons on a Search Page?

 

Thank you for your time!

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Hi Cameron,

 

You can add an HTML Block, click the "Source" button and enter the following code (the code can be used as it is, if the Listbox is the first field on the Search page. You can find the instructions how to define the id of a field in the article):
<script type="text/javascript">
function selectAllOptions()
{
var ref = document.getElementById("Value1_1");
for(i=0; i<ref.options.length; i++)
ref.options[i].selected = true;
}

function DeselectAllOptions()
{
var ref = document.getElementById("Value1_1");
for(i=0; i<ref.options.length; i++)
ref.options[i].selected = false;
}
</script>

<input type="button" value="Select All" onclick="selectAllOptions();" />
<input type="button" value="Deselect All" onclick="DeselectAllOptions();" />
I hope, it helps.
Link to comment
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.

Guest
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.

Loading...
×
×
  • Create New...