Restrict Multilist with search to a single item

Sitecore 7 comes with the multiselect with search field type which is really handy when it comes to datasource locations with a large number of items, and also for data sources which are item buckets, since navigating through the folder structure within an item bucket can definitely be quite daunting.

I am using sitecore 7.2 and came across the need to allow the content author to select a single item from a large bucket of items.
You can ofcourse opt for creating custom fields, but the easiest way to add this constraint turned out to be adding a suitable validation regex on the intended field:


You could add the intended message to the content author as well:

Now, on save, the validation message will be triggered:

If you are using glass mapper, in your custom model (will work with auto map too), you can now have a single corresponding glass object as opposed to having an IEnumerable collection.

One thought on “Restrict Multilist with search to a single item

  1. Thanks for this. It’s an interesting work around that you are validating if it is a GUID. I guess if you have a one or empty validation, you could make sure there are no pipes ‘|’, as the pipe is the delimiter between GUIDS when there are multiple items.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s