leekelleher / umbraco-contentment

Contentment for Umbraco - a state of happiness and satisfaction
https://marketplace.umbraco.com/package/umbraco.community.contentment
Mozilla Public License 2.0
154 stars 70 forks source link

Maximum items in Data Picker not preventing to add more than allowed number of items #379

Open ewuski opened 7 months ago

ewuski commented 7 months ago

Which Contentment version are you using?

4.6.0

Which Umbraco version are you using? For example: 10.3.2 - don't just write v10

Umbraco 10.4.0

Bug summary

Umbraco.Community.Contentment.DataPicker allows to set Maximum items limit. It is not validating the number of items selected, it only prevents selecting more items when the items are already selected.

Steps to reproduce

  1. Create a new data type using [Contentment] Data Picker (Umbraco.Community.Contentment.DataPicker)
  2. As the Data Source select a country list (.NET Countries (ISO 3166-1))
  3. Set Maximum items property to a desired value higher than 0 (low value will be more useful in this case)
  4. Assign the data type to a doc type or element type property
  5. Save the data type and the doc type, create a content based on the doc type in the Content section and go to add the value in the content.
  6. Click Add button to add values to the property of newly created data type, select more than the value set in Maximum items limit of the data type.
  7. Save

More than allowed Maximum items values can be selected if selected in one go or if selected before the limit has been reached. They also can be saved. No validation is present to disallow selection of more items than set in Maximum items.

Expected result / actual result

It should not allow to save the property with more items than set in the Maximum items It should prevent selection or it should throw a validation error if more items selected.

Do you have Umbraco ModelsBuilder enabled?

What browsers are you seeing the problem on?

Chrome

ewuski commented 7 months ago

Maximum 3 items allowed:

Zrzut ekranu 2024-01-31 o 20 00 03

Selecting items:

Zrzut ekranu 2024-01-31 o 20 04 39

Saved items:

Zrzut ekranu 2024-01-31 o 20 04 54

which are more than 3 Maximum allowed.