12

I have a template in which I want to provide a field where editors can select 1 item from a bucket. I am just not sure which field type I should use. The best match for working with buckets seems to be the "Multilist with Search", but that is more suited for selecting multiple items and I need only (and max) 1.

Does anyone have any experience on this - where your editors were happy with the result?

  • This was also asked on SO: stackoverflow.com/a/30503267/61470 – user561 Oct 10 '16 at 14:21
  • The question was phrased differently but the answers are indeed valid. Thx. – Gatogordo Oct 10 '16 at 14:24
  • 1
    I made a project that adds search enabled fields: github.com/Barsonax/SitecoreSearchFields Currently there is both a SingleLink and a MultiLink which both offer the same rich search interface you normally get for buckets. – Barsonax Oct 31 at 10:22
8

I've used a multilist with search and just used a regex in the validate field to limit to choices to the field requirements know each case.

Here is an example regex that limits zero to 5 items ^({[^}]+}|?){0,5}$

For zero to 1 item change the 0,5 to 0,1. To force one item set to 1,1.

Src blog post by Ben Ramey

  • Can you elaborate on the regex validation? How would do I do that to allow only one result? – Gatogordo Oct 10 '16 at 13:12
  • Updated the answer as best I can. The mobile app is hard to use! – Richard Seal Oct 10 '16 at 13:30
  • This seems to work fine with Content Editor but not with Custom experience Field Editor buttons in Experience Editor. Anyone have an idea? – Filip Jönsson Dec 21 '18 at 9:44
1

I don't think there is such field. It's probably a good thing to suggest for Sitecore though as it's not my first time I see such request. The way I see it you have two options

  1. implement the custom field
  2. use a mix of multilist with search with validation to limit the amount of items you can associate with the field(not the best choice but it is a workaround that works)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.