Dexterity XML Form Field Validation

I want to set up Form Field validation in xml, yet the form i am working on is not validating the way it should.

This is what i have so far:


External Contact Name


External Contact Phone

I needed to upload a screenshot since I couldn't copy it directly from text editor.

Indent all you code by 4 spaces.

What do you mean by 'not validating as it should'? What do you enter and what is the message?

If you just need to add min and max values, I think all you need to specify is the min and max values, something like

<field type="zope.schema.Int",

and probably

<field type="zope.schema.TextLine"

When I said 'not validating as it should' this is what i meant: When I enter a number in the name field no error comes up. When I enter a name in the number field no error comes up.

When you enter a number in the name field, there is no reason it should not validate. A number is a 'legal (text) character'. A lot of textfields 'uses numbers', like 'Taxi-1' and 'Someroad 23'

Your number field has been defined as a textfield and is behaving as it should.
If you need to validate numbers (by using 'math'), you need to define it as Int (usually)

So, if you phone can only be 4 digits, it would be something like this

<field type="zope.schema.Int",

Okay, thanks for your help!