Inputs

BForms exposes two ways of building input elements using Razor HTML extension methods: the first way of doing this is through the BsControlAttribute in combination with
BsInputFor helper, the BsInputFor will render the specified input type based on the selected value of the BsControlType enum.
Another way is to use a specialized helper like BsTextBoxFor, BsTextAreaFor and so on.

We recommend you use the generic BsInputFor helper, this declarative approach makes the Model the place where you can decide the behavior of your form.
When you need to change the output of a certain model property all you need to do is change the BsControlType designated for that property
- this way you don't have to modify the view at all.

In ASP.NET MVC the behavior of a certain property is determined by mixing attributes like Description, DataType and Required
with specialized helpers like TextBoxFor. BFroms tries to simplify this process by only using attributes and a generic helper.
In order to maintain compatibility with MVC, BForms will expose the same specialized helpers as MVC does, so if you don’t like the declarative approach
you can still use BForms.

Input helper

In order to render text inputs you will need to use the
@Html.BsInputFor helper extension and
decorate your model property with BsControlAttribute and DisplayAttribute.
You can choose from standard HTML inputs like
Text, Password, TextArea
or HTML5-flavored inputs like
Email, Url, Number, Color.

All the text inputs rendered by @Html.BsInputFor support placeholder and description tooltip.
The placeholder text is extracted from the Prompt property of the Display attribute,
while the description tooltip uses the Description property.

Besides text inputs, the BsInputFor helper can render the following types:
Checkbox, Radio, Date, Time, Datetime and File.

Email Input

In order to render a text input of type email you will need to use the
@Html.BsInputFor helper extension and
decorate your model property with [BsControl(BsControlType.Email)].
Using BsControlType.Email will enforce email validation on both client and server side.

Number Picker Input

In order to render a text input of type number picker you will need to use the
@Html.BsInputFor helper extension and
decorate your model property with [BsControl(BsControlType.Number)]. Also the model property must be of type BsRangeItem<int>.

Example Initialization

Number Inline Input

In order to render a text input of type number inline you will need to use the
@Html.BsInputFor helper extension and
decorate your model property with [BsControl(BsControlType.NumberInline)]. Also the model property must be of type BsRangeItem<int>.

Example Initialization

CheckBox Input

In order to render an input of type checkbox you will need to use the
@Html.BsInputFor helper extension and
decorate your model property with [BsControl(BsControlType.CheckBox)].

If you need to make the input checked state required, BForms comes with a BsMandatory attribute made just for that.
This attribute allows you to localize the error message using the ErrorMessageResourceName property.

View

Date and DateTime Picker

In order to render a text input of type date or datetime you will need to use the
@Html.BsInputFor helper extension and
decorate your model property of type BsDateTime with [BsControl(BsControlType.DatePicker)] or BsControlType.DateTimePicker.
Using BsControlType.DatePicker will enforce datetime validation on both client and server side using the specified culture.

View

Time Picker

In order to render a text input of type time you will need to use the
@Html.BsInputFor helper extension and
decorate your model property of type BsDateTime with [BsControl(BsControlType.TimePicker)].
Using BsControlType.TimePicker will enforce time validation on both client and server side.