>

Typed Inputs

The TypedTextBox  adds the following features to the usual TextBox rendered with the standard MVC helpers:

  • When it is empty it shows a watermark, and applies a watermark style. The watermark is defined by the Prompt property of the standard  .Net DisplayAttribute, and can be overridden by an helper parameter.
  • When the user is not editing it and it is not empty, it shows a "formatted" data. All format specifications are furnished either by an Mvc Controls Toolkit  FormatAttribute or by a standard Asp.net Mvc DisplayFormatAttribute.
  • When in edit mode all formatting disappears to allow editing. In case of numbers only characters adequate for the TextBox type are allowed while typing. Thus, for instance in case of an unsigned integer no sign and no decimal separator are allowed.
  • When editing DateTimes, if an optional CalendarOptions object is passed as argument, it shows a date picker. 

Below a TypedTextBox in watermark mode:

TypedTextBox in watermark mode

The same TypedTextBox after it has been filled with a float:

TypedTextBox filled with a float

A TypedTextBox while editing a date:

TypedTextBox editing a date

The TypedEditDisplay is similar to the TypedTextBox. The only difference being that when it is not in edit mode it is transformed into a static text. It enters edit mode with a mouse click (or with a touch).

The DateTimeInput may accept both a date and a time. The date may be inserted either with a date-picker or with 3 dropdowns, while the time is always entered with 3 dropdowns. Complex network of <, >, <=, >= constrains may be defined between different DateTime properties, with the help of attributes. Constraints are enforced in various ways by DateTimeInputs on the client-side.