void SetInputElementType() { if (HasAttribute("type")) { string TypeVal = GetAttribute("type"); if (TypeVal.Equals("password", StringComparison.OrdinalIgnoreCase)) { EleType = InputElementType.Password; } else if (TypeVal.Equals("hidden", StringComparison.OrdinalIgnoreCase)) { EleType = InputElementType.Hidden; } else if (TypeVal.Equals("submit", StringComparison.OrdinalIgnoreCase)) { EleType = InputElementType.Submit; } else if (TypeVal.Equals("checkbox", StringComparison.OrdinalIgnoreCase)) { EleType = InputElementType.Checkbox; } else if (TypeVal.Equals("radio", StringComparison.OrdinalIgnoreCase)) { EleType = InputElementType.Radio; } else if (TypeVal.Equals("text", StringComparison.OrdinalIgnoreCase)) { EleType = InputElementType.Text; } } }
/// <summary> /// Applies the validation. /// </summary> /// <param name="inputType">Type of the input.</param> /// <param name="target">The target.</param> /// <param name="attributes">The attributes.</param> protected virtual void ApplyValidation(InputElementType inputType, string target, ref IDictionary attributes) { var disableValidation = CommonUtils.ObtainEntryAndRemove(attributes, "disablevalidation", "false") == "true"; if (!IsValidationEnabled || disableValidation) { return; } if (validatorRegistry == null || validationConfig == null) { return; } if (attributes == null) { attributes = new HybridDictionary(true); } var validators = CollectValidators(RequestContext.All, target); var generator = validatorProvider.CreateGenerator(validationConfig, inputType, attributes); var id = CreateHtmlId(attributes, target, false); foreach (var validator in validators) { if (validator.SupportsBrowserValidation) { validator.ApplyBrowserValidation(validationConfig, inputType, generator, attributes, id); } } }
/// <summary> /// Applies the browser validation by setting up one or /// more input rules on <see cref="IBrowserValidationGenerator"/>. /// </summary> /// <param name="config">The config.</param> /// <param name="inputType">Type of the input.</param> /// <param name="generator">The generator.</param> /// <param name="attributes">The attributes.</param> /// <param name="target">The target.</param> public override void ApplyBrowserValidation(BrowserValidationConfiguration config, InputElementType inputType, IBrowserValidationGenerator generator, IDictionary attributes, string target) { base.ApplyBrowserValidation(config, inputType, generator, attributes, target); generator.SetDigitsOnly(target, BuildErrorMessage()); }
public override void ApplyBrowserValidation(BrowserValidationConfiguration config, InputElementType inputType, IBrowserValidationGenerator generator, IDictionary attributes, string target) { base.ApplyBrowserValidation(config, inputType, generator, attributes, target); generator.SetAsNotSameAs(target, this.propertyToCompare, this.BuildErrorMessage()); }
private void ValidateInputNode( ParsedInputElement node, string element, InputElementType type, int index, ParsedInputElement pairedWith, string value, int startPos = -1, int endPos = -1) { node.Raw.Should().Be(element); node.ElementType.Should().Be(type); node.Index.Should().Be(index); node.IsPairedWith.Should().Be(pairedWith); node.Value.Should().Be(value); if (startPos > -1) { node.StartPosition.Should().Be(startPos); } if (endPos > -1) { node.EndPosition.Should().Be(endPos); } }
public void EnsureValueType() { var type = InputElementType.ResolveValueType(this); if (type != null) { ValueType = type; } }
public void AppendField(int sort, string name, string field, InputElementType Type, IDictionary <int, string> selectValue) { this.ApplyChange(new ChannelExtendFieldsCreatedEvent { AggregateId = this.AggregateId, Timestamp = DateTime.Now, Sort = sort, Field = field, Name = name, Type = Type, SelectValue = selectValue }); }
public InputPropertyPanel(InputElementType elementType, String name, String text, String value) { this.ElementType = elementType; if (this.ElementType == InputElementType.Color) { this.LoadDefaultColor(); } this.Name = name; this.Text = text; this.RadioButtonGroupName = name; this.ValidationResultMessagePanel.ValidationName.SetValue(name); this.Value = value; foreach (var item in Default.DurationList) { this.DurationList.Add(new PropertyValueItem(item.Value)); } this.SelectedDuration = "1:00"; }
public InputPropertyPanel(InputElementType elementType, String name, String text, Guid value) : this(elementType, name, text, value.ToString()) { }
/// <summary> /// Applies the browser validation by setting up one or /// more input rules on <see cref="IBrowserValidationGenerator"/>. /// </summary> /// <param name="config">The config.</param> /// <param name="inputType">Type of the input.</param> /// <param name="generator">The generator.</param> /// <param name="attributes">The attributes.</param> /// <param name="name">The name.</param> public void ApplyBrowserValidation(BrowserValidationConfiguration config, InputElementType inputType, IBrowserValidationGenerator generator, IDictionary attributes, string name) { generator.SetAsGroupValidation(name, Name, BuildErrorMessage()); }
public InputPropertyPanel(InputElementType elementType, String name, String text) : this(elementType, name, text, "") { }
/// <summary> /// Initializes a new instance of the <see cref="FValidateGenerator"/> class. /// </summary> /// <param name="inputType">Type of the input.</param> /// <param name="attributes">The attributes.</param> public FValidateGenerator(InputElementType inputType, IDictionary attributes) { this.inputType = inputType; this.attributes = attributes; }
/// <summary> /// Applies the browser validation by setting up one or /// more input rules on <see cref="IBrowserValidationGenerator"/>. /// </summary> /// <param name="config">The config.</param> /// <param name="inputType">Type of the input.</param> /// <param name="generator">The generator.</param> /// <param name="attributes">The attributes.</param> /// <param name="target">The target.</param> public override void ApplyBrowserValidation(BrowserValidationConfiguration config, InputElementType inputType, IBrowserValidationGenerator generator, System.Collections.IDictionary attributes, string target) { base.ApplyBrowserValidation(config, inputType, generator, attributes, target); generator.SetRegExp(target, @"^((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})$", BuildErrorMessage()); }
/// <summary> /// Applies the browser validation by setting up one or /// more input rules on <see cref="IBrowserValidationGenerator"/>. /// </summary> /// <param name="config">The config.</param> /// <param name="inputType">Type of the input.</param> /// <param name="generator">The generator.</param> /// <param name="attributes">The attributes.</param> /// <param name="target">The target.</param> public virtual void ApplyBrowserValidation(BrowserValidationConfiguration config, InputElementType inputType, IBrowserValidationGenerator generator, IDictionary attributes, string target) { }
/// <summary> /// Initializes a new instance of the <see cref="JQueryValidationGenerator"/> class. /// </summary> /// <param name="configuration">The configuration.</param> /// <param name="inputElementType">Type of the input element.</param> /// <param name="propertyNameToElementId">The attributes.</param> public JQueryValidationGenerator(JQueryValidator.JQueryConfiguration configuration, InputElementType inputElementType, Func<string, string> propertyNameToElementId) { _inputElementType = inputElementType; _propertyNameToElementId = propertyNameToElementId; _config = configuration; }
/// <summary> /// Applies the browser validation by setting up one or /// more input rules on <see cref="IBrowserValidationGenerator"/>. /// </summary> /// <param name="config">The config.</param> /// <param name="inputType">Type of the input.</param> /// <param name="generator">The generator.</param> /// <param name="attributes">The attributes.</param> /// <param name="target">The target.</param> public override void ApplyBrowserValidation(BrowserValidationConfiguration config, InputElementType inputType, IBrowserValidationGenerator generator, IDictionary attributes, string target) { base.ApplyBrowserValidation(config, inputType, generator, attributes, target); generator.SetAsLesserThan(target, PropertyToCompare, validationType, BuildErrorMessage()); }
/// <summary> /// Applies the browser validation by setting up one or /// more input rules on <see cref="IBrowserValidationGenerator"/>. /// </summary> /// <param name="config">The config.</param> /// <param name="inputType">Type of the input.</param> /// <param name="generator">The generator.</param> /// <param name="attributes">The attributes.</param> /// <param name="target">The target.</param> public override void ApplyBrowserValidation(BrowserValidationConfiguration config, InputElementType inputType, IBrowserValidationGenerator generator, IDictionary attributes, string target) { base.ApplyBrowserValidation(config, inputType, generator, attributes, target); switch (type) { case RangeValidationType.Integer: generator.SetValueRange(target, (int)min, (int)max, BuildErrorMessage()); break; case RangeValidationType.Long: generator.SetValueRange(target, (long)min, (long)max, BuildErrorMessage()); break; case RangeValidationType.Decimal: generator.SetValueRange(target, (decimal)min, (decimal)max, BuildErrorMessage()); break; case RangeValidationType.DateTime: generator.SetValueRange(target, (DateTime)min, (DateTime)max, BuildErrorMessage()); break; case RangeValidationType.String: generator.SetValueRange(target, (string)min, (string)max, BuildErrorMessage()); break; default: throw new ArgumentOutOfRangeException(); } }
/// <summary> /// Initializes a new instance of the <see cref="ZebdaWebValidationGenerator"/> class. /// </summary> /// <param name="inputType">Type of the input.</param> /// <param name="attributes">The attributes.</param> public ZebdaWebValidationGenerator(InputElementType inputType, IDictionary attributes) { this.attributes = attributes; }
/// <summary> /// Initializes a new instance of the <see cref="PrototypeValidationGenerator"/> class. /// </summary> /// <param name="config">Validation configuration instance</param> /// <param name="inputType">Type of the input.</param> /// <param name="attributes">The attributes.</param> public PrototypeValidationGenerator(PrototypeValidationConfiguration config, InputElementType inputType, IDictionary attributes) { this.config = config; this.inputType = inputType; this.attributes = attributes; }
public override void ApplyBrowserValidation(BrowserValidationConfiguration config, InputElementType inputType, IBrowserValidationGenerator generator, System.Collections.IDictionary attributes, string target) { }
public PrototypeValidationGeneratorExtension(PrototypeWebValidator.PrototypeValidationConfiguration config, InputElementType inputType, IDictionary attributes) : base(config, inputType, attributes) { _config = config; }
/// <summary> /// Implementors should return their generator instance. /// </summary> /// <param name="configuration"></param> /// <param name="inputType"></param> /// <param name="propertyNameToElementId"></param> /// <returns>A generator instance</returns> public IBrowserValidationGenerator CreateGenerator(BrowserValidationConfiguration configuration, InputElementType inputType, Func <string, string> propertyNameToElementId) { return(new JQueryValidationGenerator((JQueryConfiguration)configuration, inputType, propertyNameToElementId)); }
public override void ApplyBrowserValidation(BrowserValidationConfiguration config, InputElementType inputType, IBrowserValidationGenerator generator, System.Collections.IDictionary attributes, string target) { base.ApplyBrowserValidation(config, inputType, generator, attributes, target); string message = string.Format(defaultErrorMessage, _minLength); generator.SetMinLength(target, _minLength, ErrorMessage ?? message); }
/// <summary> /// Applies the browser validation by setting up one or /// more input rules on <see cref="IBrowserValidationGenerator"/>. /// </summary> /// <param name="config">The config.</param> /// <param name="inputType">Type of the input.</param> /// <param name="generator">The generator.</param> /// <param name="attributes">The attributes.</param> /// <param name="target">The target.</param> public override void ApplyBrowserValidation(BrowserValidationConfiguration config, InputElementType inputType, IBrowserValidationGenerator generator, IDictionary attributes, string target) { base.ApplyBrowserValidation(config, inputType, generator, attributes, target); if (exactLength != int.MinValue) { string message = string.Format(GetString(MessageConstants.ExactLengthMessage), exactLength); generator.SetExactLength(target, exactLength, ErrorMessage ?? message); } else { if (minLength != int.MinValue && maxLength != int.MaxValue) { string message = string.Format(GetString(MessageConstants.LengthInRangeMessage), minLength, maxLength); generator.SetLengthRange(target, minLength, maxLength, ErrorMessage ?? message); } else { if (minLength != int.MinValue) { string message = string.Format(GetString(MessageConstants.LengthTooShortMessage), minLength); generator.SetMinLength(target, minLength, ErrorMessage ?? message); } if (maxLength != int.MaxValue) { string message = string.Format(GetString(MessageConstants.LengthTooLongMessage), maxLength); generator.SetMaxLength(target, maxLength, ErrorMessage ?? message); } } } }
/// <summary> /// Implementors should return their generator instance. /// </summary> /// <param name="configuration"></param> /// <param name="inputType"></param> /// <param name="attributes"></param> /// <returns>A generator instance</returns> public IBrowserValidationGenerator CreateGenerator(BrowserValidationConfiguration configuration, InputElementType inputType, IDictionary attributes) { return new JQueryValidationGenerator((JQueryConfiguration) configuration); }
/// <summary> /// Applies the browser validation. /// </summary> /// <param name="config">The config.</param> /// <param name="inputType">Type of the input.</param> /// <param name="generator">The generator.</param> /// <param name="attributes">The attributes.</param> /// <param name="target">The target.</param> public override void ApplyBrowserValidation(BrowserValidationConfiguration config, InputElementType inputType, IBrowserValidationGenerator generator, IDictionary attributes, string target) { generator.SetEmail(target, BuildErrorMessage()); }
/// <summary> /// Applies the browser validation by setting up one or /// more input rules on <see cref="IBrowserValidationGenerator"/>. /// </summary> /// <param name="config">The config.</param> /// <param name="inputType">Type of the input.</param> /// <param name="generator">The generator.</param> /// <param name="attributes">The attributes.</param> /// <param name="target">The target.</param> public override void ApplyBrowserValidation(BrowserValidationConfiguration config, InputElementType inputType, IBrowserValidationGenerator generator, IDictionary attributes, string target) { }
/// <summary> /// Implementors should return their generator instance. /// </summary> /// <param name="config"></param> /// <param name="inputType"></param> /// <param name="attributes"></param> /// <returns>A generator instance</returns> public IBrowserValidationGenerator CreateGenerator(BrowserValidationConfiguration config, InputElementType inputType, IDictionary attributes) { return(new FValidateGenerator(inputType, attributes)); }
/// <summary> /// Implementors should return their generator instance. /// </summary> /// <param name="config"></param> /// <param name="inputType"></param> /// <param name="attributes"></param> /// <returns>A generator instance</returns> public IBrowserValidationGenerator CreateGenerator(BrowserValidationConfiguration config, InputElementType inputType, IDictionary attributes) { return new FValidateGenerator(inputType, attributes); }
/// <summary> /// Applies the browser validation by setting up one or /// more input rules on <see cref="IBrowserValidationGenerator"/>. /// </summary> /// <param name="config">The config.</param> /// <param name="inputType">Type of the input.</param> /// <param name="generator">The generator.</param> /// <param name="attributes">The attributes.</param> /// <param name="target">The target.</param> public override void ApplyBrowserValidation(BrowserValidationConfiguration config, InputElementType inputType, IBrowserValidationGenerator generator, IDictionary attributes, string target) { base.ApplyBrowserValidation(config, inputType, generator, attributes, target); switch(type) { case RangeValidationType.Integer: generator.SetValueRange(target, (int) min, (int) max, BuildErrorMessage()); break; case RangeValidationType.Long: generator.SetValueRange(target, (long)min, (long)max, BuildErrorMessage()); break; case RangeValidationType.Decimal: generator.SetValueRange(target, (decimal) min, (decimal) max, BuildErrorMessage()); break; case RangeValidationType.DateTime: generator.SetValueRange(target, (DateTime) min, (DateTime) max, BuildErrorMessage()); break; case RangeValidationType.String: generator.SetValueRange(target, (string) min, (string) max, BuildErrorMessage()); break; default: throw new ArgumentOutOfRangeException(); } }
/// <summary> /// Implementors should return their generator instance. /// </summary> /// <param name="configuration"></param> /// <param name="inputType"></param> /// <param name="attributes"></param> /// <returns>A generator instance</returns> public IBrowserValidationGenerator CreateGenerator(BrowserValidationConfiguration configuration, InputElementType inputType, IDictionary attributes) { return(new JQueryValidationGenerator((JQueryConfiguration)configuration)); }
public override void ApplyBrowserValidation(BrowserValidationConfiguration config, InputElementType inputType, IBrowserValidationGenerator generator, System.Collections.IDictionary attributes, string target) { base.ApplyBrowserValidation(config, inputType, generator, attributes, target); generator.SetDate(target, BuildErrorMessage()); }
/// <summary> /// Implementors should return their generator instance. /// </summary> /// <param name="configuration"></param> /// <param name="inputType"></param> /// <param name="propertyNameToElementId"></param> /// <returns>A generator instance</returns> public IBrowserValidationGenerator CreateGenerator(BrowserValidationConfiguration configuration, InputElementType inputType, Func<string, string> propertyNameToElementId) { return new JQueryValidationGenerator((JQueryConfiguration)configuration, inputType, propertyNameToElementId); }
public InputPropertyPanel(InputElementType elementType, String name, String text, Boolean value) : this(elementType, name, text, value.ToString().ToLower()) { }
public FieldValueObject(int Sort, string name, string field, InputElementType type, IDictionary <int, string> selectValue) : base(field, type) { this.SelectValue = selectValue; this.Name = name; this.Sort = Sort; }
/// <summary> /// Applies the validation. /// </summary> /// <param name="inputType">Type of the input.</param> /// <param name="target">The target.</param> /// <param name="attributes">The attributes.</param> 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); } } }
/// <summary> /// Initializes a new instance of the <see cref="JQueryValidationGenerator"/> class. /// </summary> /// <param name="configuration">The configuration.</param> /// <param name="inputElementType">Type of the input element.</param> /// <param name="propertyNameToElementId">The attributes.</param> public JQueryValidationGenerator(JQueryValidator.JQueryConfiguration configuration, InputElementType inputElementType, Func <string, string> propertyNameToElementId) { _inputElementType = inputElementType; _propertyNameToElementId = propertyNameToElementId; _config = configuration; }
public InputElementValueObject(string field, InputElementType type) { this.Field = field; this.Type = type; }
public new IBrowserValidationGenerator CreateGenerator(BrowserValidationConfiguration config, InputElementType inputType, IDictionary attributes) { return(new PrototypeValidationGeneratorExtension((PrototypeWebValidator.PrototypeValidationConfiguration)config, inputType, attributes)); }
/// <summary> /// Applies the browser validation by setting up one or /// more input rules on <see cref="IBrowserValidationGenerator"/>. /// </summary> /// <param name="config">The config.</param> /// <param name="inputType">Type of the input.</param> /// <param name="generator">The generator.</param> /// <param name="attributes">The attributes.</param> /// <param name="target">The target.</param> public override void ApplyBrowserValidation(BrowserValidationConfiguration config, InputElementType inputType, IBrowserValidationGenerator generator, IDictionary attributes, string target) { base.ApplyBrowserValidation(config, inputType, generator, attributes, target); generator.SetRegExp(target, expression, BuildErrorMessage()); }