question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Minimum length validation ListBLock

See original GitHub issue

It 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:closed
  • Created 8 years ago
  • Reactions:18
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
CuriousLearnercommented, Oct 17, 2019

Hello,

Thank you for all your hard work on this. It is a much-needed feature. Is there an expected timeline for its release?

2reactions
BertrandBordagecommented, Mar 21, 2019

@thibaudcolas I confirm.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found