Restrictions - Demonstration

In the following demonstration each of the restriction types is presented.

 
Validation Example
Pattern example - provide email
Length example - provide exactly 10 characters
Exactly10 Characters
10
MinLength example - provide 3 characters or more
Min Length Of3
3
MaxLength example - provide 7 characters or less
Max Length Of7
7
MaxExclusive example - provide a value lower than 100
Lower Than100
100
MaxInclusive example - provide a value lower than or equal 20
Lower Or Equal20
20
MinExclusive example - provide a value higher than 40
Higher Than40
40
MinInclusive example - provide a value higher than or equal 10
Higher Or Equal10
10
Total digits example - provide a value with no more than 3 digits
Leaf1
3
Fraction digits example - provide a value with no more than 2 fraction digits
Leaf2
2
XML output

        
Restrictions - Description

The aim of the restriction constraint is to port all the data type restrictions from xsd to the MForm control.

When generating the form from the schema, the restrictions will appear in the Additions property of the corresponding item.

The Restriction control has two important properties:

  • RestrictionType - the restriction type
  • Value - the value that the restriction will consume

There are several constraint types, most of them corresponding to the xml schema restriction types:

  • MaxLength - the maximal field length
  • MinLength - the minimal field length
  • Length - the exact field length
  • MinInclusive - the field value parsed as number cannot be lower than or equal the specified value
  • MinExclusive - the field value parsed as number cannot be lower than the specified value
  • MaxInclusive - the field value parsed as number cannot be higher than or equal the specified value
  • MaxExclusive - the field value parsed as number cannot be higher than the specified value
  • Pattern - the field value must match the specified pattern (the pattern should be written in the Value property)
  • TotalDigits - the field value parsed as number cannot have more total number of digits than the specified value
  • FractionDigits - the field value parsed as number cannot have more fraction digits than the specified value