/// <summary>
        /// Disables the validation on submit.
        /// </summary>
        /// <param name="model">The model.</param>
        protected virtual void DisableValidationOnSubmit([NotNull] RuleContextModel model)
        {
            Assert.ArgumentNotNull(model, nameof(model));

            if (this.Match(this.GetValue(model, this.Trigger), this.TriggerValue))
            {
                this.DisableValidation(null, model);
            }
        }
        /// <summary>
        /// Disables the validation.
        /// </summary>
        /// <param name="control">The control.</param>
        /// <param name="model">The model.</param>
        protected void DisableValidation([CanBeNull] Control control, [CanBeNull] RuleContextModel model)
        {
            if (control != null)
            {
                foreach (var validator in control.Controls.Flatten().OfType <BaseValidator>())
                {
                    validator.Enabled = false;
                }
            }

            if (model != null)
            {
                var modelState = model.ModelState;
                modelState.Errors.Clear();
            }
        }
        protected override void DisableValidationOnSubmit(RuleContextModel model)
        {
            var operatorItem = Context.Database.GetItem(this.Operator);

            if (operatorItem == null)
            {
                return;
            }

            var match = this.Match(this.GetValue(model, this.Trigger2), this.TriggerValue2);

            if (match && operatorItem.Name == "and" || !match && operatorItem.Name != "and")
            {
                base.DisableValidationOnSubmit(model);
                return;
            }

            if (match)
            {
                base.DisableValidationOnSubmit(model);
            }
        }
        /// <summary>
        /// Gets the value.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="fieldItemId">The field item identifier.</param>
        /// <returns></returns>
        protected object GetValue(RuleContextModel model, string fieldItemId)
        {
            var result = model.Form.GetField(fieldItemId) as IFieldResult;

            return(result?.GetResult().Value);
        }