Completed
Last Updated: 15 Jul 2022 13:41 by ADMIN
Release 2022.R2.SP.next
Lauren
Created on: 14 Jun 2022 05:08
Category: TextBox
Type: Bug Report
1
The TextBox TagHelper does not render the maxlength and placeholder attributes

Bug report

The TextBox TagHelper does not render the maxlength and placeholder attributes when set via data annotations.

Reproduction of the problem

For a model property defined the following way

[Display(Name = "Example", Prompt = "Example Prompt")]
[StringLength(maximumLength : 5, MinimumLength = 1, ErrorMessage = "Must be between 1 and 5")]
public string Example { get ; set ; }

the TextBox TagHelper generetes

<input
  class="form-control k-input-inner"
  data-val="true"
  data-val-length="Must be between 1 and 5"
  data-val-length-max="5"
  data-val-length-min="1"
  id="Example"
  name="Example"
  value=""
  data-role="textbox"
  style="width: 100%;"
  aria-disabled="false"
  autocomplete="off"
  aria-invalid="true"
  aria-describedby="Example_validationMessage">

when the default ASP.NET Core TagHelper generates markup containing the maxlength and placeholder attributes:

<input
  class="form-control k-invalid"
  type="text"
  data-val="true"
  data-val-length="Must be between 1 and 5"
  data-val-length-max="5"
  data-val-length-min="1"
  id="Example"
  maxlength="5"
  name="Example"
  placeholder="Example Prompt"
  value=""
  aria-invalid="true"
  aria-describedby="Example_validationMessage">

Expected/desired behavior

The maxlength and placeholder attributes are set to the generated input element.

Environment

  • Kendo UI version: 2022.2.510
  • Browser: [all]
0 comments