London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

Migrating off ValidatorTypesToBeExcluded

Vote:
 

I'm upgrading some old forms code to move off of obsoleted methods. I've encountered the following warning message and have found no path to update a form block away from ValidatorTypesToBeExcluded on ValidatableElementBlockBase.

'HiddenEmailBlock.ValidatorTypesToBeExcluded' overrides obsolete member 'ValidatableElementBlockBase.ValidatorTypesToBeExcluded'. Add the Obsolete attribute to 'HiddenEmailBlock.ValidatorTypesToBeExcluded'. 

The method in question is:

        public override Type[] ValidatorTypesToBeExcluded
        {
            get => new[]
            {
                typeof(EmailValidator),
                typeof(DateDDMMYYYYValidator),
                typeof(DateMMDDYYYYValidator),
                typeof(DateYYYYMMDDValidator),
                typeof(RegularExpressionValidator),
                typeof(IntegerValidator),
                typeof(PositiveIntegerValidator),
                typeof(RequiredValidator)
            };
            set { }
        }



Any advice on what I need to do to move this functionality to get it current would be greatly appreciated. I can't find any documentation on Forms at all and I don't see this method in a breaking change list anywhere in the updates. 

#194671
Jun 27, 2018 20:22
Vote:
 

You can use AvailableValidatorTypesAttribute to specify the validators for element.

[AvailableValidatorTypes(Include = new[] { typeof(RequiredValidator), typeof(IntegerValidator), typeof(PositiveIntegerValidator) })]
public class YourElementBlock : InputElementBlockBase
{
}



#194677
Jun 28, 2018 4:35
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.