I have a registration form with a DateTimeDropdown
claim type to allow a user to select their date of birth.
This is the policy configuration of the claim:
<ClaimType Id="dateOfBirth">
<DisplayName>Date of birth</DisplayName>
<DataType>date</DataType>
<UserHelpText>Please select your birth date</UserHelpText>
<UserInputType>DateTimeDropdown</UserInputType>
</ClaimType>
And how it renders on the form:
The Year
selection gives a range starting at 1900 and goes up to 2050.
Is there any custom policy configuration to alter, limit, or reorder the values present in this dropdown?
This is now possible by using the PredicateValidations. See date range
With the Predicates and PredicateValidations elements you can control the minimum and maximum date values of the UserInputType by using a DateTimeDropdown
<Predicates>
<Predicate Id="DateRange" Method="IsDateRange" HelpText="The date must be between 01-01-1980 and today.">
<Parameters>
<Parameter Id="Minimum">1980-01-01</Parameter>
<Parameter Id="Maximum">Today</Parameter>
</Parameters>
</Predicate>
</Predicates>
Add a PredicateValidation with a reference to the DateRange predicate.
<PredicateValidations>
<PredicateValidation Id="CustomDateRange">
<PredicateGroups>
<PredicateGroup Id="DateRangeGroup">
<PredicateReferences>
<PredicateReference Id="DateRange" />
</PredicateReferences>
</PredicateGroup>
</PredicateGroups>
</PredicateValidation>
</PredicateValidations>
In your claim type, add PredicateValidationReference element and specify the identifier as CustomDateRange.
<ClaimType Id="dateOfBirth">
<DisplayName>Date of Birth</DisplayName>
<DataType>date</DataType>
<AdminHelpText>The user's date of birth.</AdminHelpText>
<UserHelpText>Your date of birth.</UserHelpText>
<UserInputType>DateTimeDropdown</UserInputType>
<PredicateValidationReference Id="CustomDateRange" />
</ClaimType>