public void Validate(NestedModel state, IFormContext formContext) { if (state.Selection != "Washington" && formContext.TryGetFormField("stateInput", out IFormField selectionData)) { selectionData.IsValid = false; selectionData.ValidationMessage = "Washington!!!!!!!"; } }
public void Validate(Model state, IFormContext formContext) { _nestedReducer.Validate(state.Nested, formContext); if (state.Age < 12 && formContext.TryGetFormField("ageInput", out IFormField ageData)) { ageData.IsValid = false; ageData.ValidationMessage = "You must be 12 to ride this amusement park attraction"; } }