Custom Controls > Widget Reference > Text Input |
Member Of | Wijmo Value Control |
Base Control | HTML5 input, type=text |
Description | Provides a default implementation of a value custom control. |
Usage | Apply to an entity property of any data type. |
Generated Code |
Copy Code
|
---|---|
myapp.ScreenName.PropertyName_render = function (element, contentItem) { var input = $("<input type='text' data-clear-btn='true'/>"); input.appendTo($(element)); input[0].onchange = function (e, args) { contentItem.value = input.val(); }; contentItem.dataBind("stringValue", function (newValue) { input.val(newValue); }); }; |
This widget is included for completeness and to provide a reasonable default implementation regardless of the underlying data type. You can also use the generated code as a starting point for working with other third-party control libraries.
The onchange event is handled to update the bound value whenever the end user changes the input control’s current value.
The dataBind method call ensures that the widget stays in sync whenever the bound value changes.