Contentful logo

Contentful Community

Displaying dropdown of numbers with validation set as range from min = 1 max = 24

content_modeling
#1

Hello All,

We want to display dropdown of numbers for a field which has range as validation e.g min=1 max=24

Requirement is to display dropdown with default set to 1 and options available from 1 to 24

Below is snippet from model definition…

articleModel
.createField("someField")
.name("Some Field Name")
.type("Integer")
.validations([
  {
    range: {
      min: 1,
      max: 24
    }
  }
]);

Can any one please suggest how can I display drop down in this case ?

Is it mandatory to set validation as “IN” instead of range and add individual number 1 to 24 to achieve a dropdown ?

Thanks,
Faizaan Shaikh

0 Likes