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?

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.