-
-
Save PetersonDave/dc14bec928c0f4313b10 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); | |
// lookup the actual form item | |
var formItem = Sitecore.Context.Database.Items[form.FormID]; | |
// obtain the WFFM field | |
var countryField = formItem.Children[validatorSettings.CountryFieldId]; | |
// get its required field value from the Checkbox field | |
Sitecore.Data.Fields.CheckboxField checkbox = countryField.Fields["Required"]; | |
if (checkbox != null) | |
{ | |
bool isRequired = checkbox.Checked; | |
// continue processing... | |
} | |
return base.OnServerValidate(value); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment