Basic #

This is the most basic usage of RegateText.

Regate.RegateText.init({
  id: 'basic-example',
  name: 'Title',
})
@Html.Raw(RegateText.Build("Title"))

Value #

With value property you can set an initial value for your textbox.

Regate.RegateText.init({
  id: 'value-example',
  name: 'Title',
  value: 'Hello World',
})
@Html.Raw(RegateText.Build("Title", "Hello World"))

Required #

You can required your field with isRequired property.

Regate.RegateText.init({
  id: 'required-example',
  name: 'Title',
  isRequired: true,
})
@Html.Raw(RegateText.Build("Title", isRequired: true))

Placeholder #

You can set the placeholder of textbox with placeholder property.

Regate.RegateText.init({
  id: 'placeholder-example',
  name: 'Title',
  placeholder: 'Please enter title',
})

onChange #

With onChange event you can get value of textbox on every user interaction with textbox. Originally, Regate will bind this event to the oninput event of textbox.

Regate.RegateText.init({
  id: 'onchange-example',
  name: 'Title',
  onChange: function ({value, isValid}) {
    console.log(value, isValid)
  }
})

onInitialized #

The onInitialized event is called once when the RegateText is initialized successfully. You have access to the value of textbox.

Regate.RegateText.init({
  id: 'oninitialized-example',
  name: 'Title',
  value: 'Hello World',
  onInitialized: function ({value, isValid}) {
    console.log(value, isValid)
  }
})