locked
Problems with Required Property in Custom Field RRS feed

  • Question

  • Hi,

    I have a custom field type with which I've created a site column. I'm using it in a content type which is associated with a list. In the configuration settings of this list I've configured this column as required in the associated content type.

    When I edit an item of the list I see a red "*" beside the column indicating me that it's required just as I've specified. The problem is that if I leave the column with no value the item is saved anyway and no message is shown requiring a value for the field.

    I overriden the GetValidatedString method to check this field and the value of the Required property that I'm checking is set to false when I debug the code in that method!! Nowhere in my code I set this value either to true nor false. I also noticed that the constructor method of my custom field type is called twice, one right after the other, when the edit page of a list item is called and I have only one column of that field type. The first time the constructor is called the value of the Required property is set to true just as expected but the second time it's called the value of the same property is equal to false.

    Does anyone know why the constructor is called twice and why the property changes its value between those calls?

    Thanks in advance,
    Claudia
    Wednesday, February 25, 2009 6:35 PM

Answers

All replies