Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Default DateItem/DateTimeItem validators

    SmartClient v10 build from 9/19/2015

    Hi there,

    I am looking for a way to make any DateItem or DateTimeItem use a type of "default" validation method. We almost always have these date fields displayed with text fields as their editor also. We have the custom validator created, and when we apply this validator to certain fields it does work... however it is something that is never going to change for us and we would like to be able to make any instances of this class perform this validation. I have tried isc.DateItem.addProperties... but that does not apply that validator to the editor in ListGridField when it is a date field.

    The reason for wanting this ability is because we have a SQL Server backend, and the lowest date that is available in SQL Server is 1/1/1753... so I would like any instance of the date items to perform validation to make sure that it is above that date. As I said before, I don't need help creating the custom validator, I just need to know if there is any way to make the list of validators have default items in it AND have them actually apply to fields that are using the class as an editor. The addProperties approach (to the classes on a global level) to achieve this does work, but just not when the class is being used in editors, like ListGridField.editorType for example.

    Sorry for the long, repetitive post - just trying to be very clear with my issue.

    #2
    Define a new SimpleType that extends "date" and add your validator, then use that type pervasively in your DataSources. If you define a server-side SimpleType, this gives you both client and server-side enforcement of the validator.

    Comment

    Working...
    X