Skip to main content

This content has been archived and is no longer being updated.

Links may not function; however, this content may be relevant to outdated versions of the product.

How to allow users to select multiple items from a SelectList control

Suggest edit Updated on May 3, 2020

Summary

A developer asks: Can I allow an application user to select multiple elements from a SelectList control? The possible choices are in a Value List property.

I was able to build the HTML code for this in an HTML Property rule, but am not sure how to get the users's selections.


 

Suggested Approach

Such multiple selections are not supported by any standard HTML property rule. As a best practice, you can present a list of labeled check boxes.  

Update: In V5.4+, a separate HTML property rule MultiSelectList is available, so the approach described here is not necessary. For an example use of the MulitSelectList rule, review the standard section rule PegaAccel-Task-CircumstanceSearch. FindByCircumstance_Circumstances.

You need a Page List that contains a property — for example the standard property @baseclass.pySelected — that is presented as a check box, and properties that name the things you want to list. 

Populate the Page List with all the entries from which you wish to select. 

Build an HTML display that, through a ForEach directive on the elements of the Page List, displays a check box and the choice element.  If the list is long, you may want to employ a scrollable <DIV > element.

Basically, after the user enters his choices, your Page List needs to contain, for each element, a name and a value indicating whether that element is selected.

Did you find this content helpful? YesNo

50% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Ready to crush complexity?

Experience the benefits of Pega Community when you log in.

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us