Minimum length validation ListBLock
See original GitHub issueIt often occurs when content editors fill in StreamField blocks with invalid content, even the form is submitted correctly. A good example is a Carousel Block. They add a CarouselBlock, but it’s not clear they have to add one ore more Slides and why the frontend seems broken. Another scenario would be adding Q/A’s for a FAQ, except you don’t want empty Categories (so at least one Q/A is required).
From this perspective it would be nice to have an optional min_length field for a ListBlock.
class CarouselSlideBlock(blocks.StructBlock):
caption = blocks.CharBlock(max_length=64)
image = ImageChooserBlock()
class CarouselBlock(blocks.StructBlock):
slides = blocks.ListBlock(CarouselSlideBlock, min_length=1)
Issue Analytics
- State:
- Created 8 years ago
- Reactions:18
- Comments:7 (5 by maintainers)
Top Results From Across the Web
How to set min length for texbox? - wpf - Stack Overflow
MaxLength sets the visual length of the control, it has nothing to do with character count. You need to implement your own validation...
Read more >StreamField block reference - Wagtail's documentation
min_length – The minimum allowed length of the field. validators – A list of validation functions for the field (see Django Validators). form_classname...
Read more >Validation Rules in JavaScript (ES5) Form Validator control
Default Rules ; digit, The form input element must have valid digit values, 1 ; maxLength, Input value must have less than or...
Read more >Validation for ListBox not working - Radzen forum
I have the following listbox with validator that will not validate ... I've tried the required and length validator and neither work.
Read more >lightning-dual-listbox - documentation - Salesforce Developers
For example, if you set min to 3 and max to 8, users must select at least 3 options and at most 8...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello,
Thank you for all your hard work on this. It is a much-needed feature. Is there an expected timeline for its release?
@thibaudcolas I confirm.