-
-
Save PetersonDave/655404ca3ea36113a341 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override bool OnServerValidate(string value) | |
{ | |
var validatorSettings = GetValidatorSettingsItem(); | |
Sitecore.Diagnostics.Assert.IsNotNull(validatorSettings, ValidationSettingsItemMissingMessage + ValidationSettingsItem); | |
// obtain an instance of the SimpleForm | |
var form = WebUtil.GetParent<SimpleForm>(this); | |
// obtain an instance of our field | |
var countryField = (CountryDropDownList)WebUtil.FindFirstOrDefault(form, c => c is CountryDropDownList && string.Compare((c as CountryDropDownList).Result.FieldName, validatorSettings.CountryFieldName) == 0); | |
if (countryField != null) | |
{ | |
// is the field required? | |
bool isRequired = countryField.Requred.Any(); | |
// continue handling further processing here... | |
} | |
return base.OnServerValidate(value); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment