Hi Jean-Nicolas,
There's currently no way to implement custom validation at the StructBlock level - the current code assumes that any ValidationErrors thrown while validating the StructBlock always originate from one of the child blocks. However, you can add custom validation on an input field within the StructBlock by subclassing the block class:
class NoSpacesCharBlock(blocks.CharBlock):
def clean(self, value):
clean_value = super(NoSpacesCharBlock, self).clean(value)
if ' ' in clean_value:
raise ValidationError("This field may not contain spaces.")
return clean_value
Cheers,
- Matt