Castle.MonoRail.Framework.Helpers.FormHelper.ApplyValidation C# (CSharp) Method

ApplyValidation() protected method

Applies the validation.
protected ApplyValidation ( InputElementType inputType, string target, IDictionary &attributes ) : void
inputType InputElementType Type of the input.
target string The target.
attributes IDictionary The attributes.
return void
		protected virtual void ApplyValidation(InputElementType inputType, string target, ref IDictionary attributes)
		{
			bool disableValidation = CommonUtils.ObtainEntryAndRemove(attributes, "disablevalidation", "false") == "true";

			if (!IsValidationEnabled && disableValidation)
			{
				return;
			}

			if (Controller.Validator == null || validationConfig == null)
			{
				return;
			}

			if (attributes == null)
			{
				attributes = new HybridDictionary(true);
			}

			IValidator[] validators = CollectValidators(RequestContext.All, target);

			IBrowserValidationGenerator generator = validatorProvider.CreateGenerator(validationConfig, inputType, attributes);

			foreach(IValidator validator in validators)
			{
				if (validator.SupportsBrowserValidation)
				{
					validator.ApplyBrowserValidation(validationConfig, inputType, generator, attributes, target);
				}
			}
		}