TextBox PHP Class Overview

The Kendo UI TextBox for PHP is a server-side wrapper for the Kendo UI TextBox widget.

The Kendo UI TextBox converts an <input> element into a styled input.

Getting Started


The TextBox provides a set of default API configuration options that can be set during its initialization such as value, placeholder, and so on. Below are listed the steps for you to follow when configuring the Kendo UI TextBox. Below are listed the steps for you to follow when configuring the Kendo UI TextBox for PHP.

Step 1 Make sure you followed all the steps from the introductory article on Telerik UI for PHP—include the autoloader, JavaScript, and CSS files.

Step 2 Create a TextBox.

    $textbox = new \Kendo\UI\TextBox('textbox');
        ->attr('style', 'width: 100%');

Step 3 Output the TextBox by echoing the result of the render method.

   <?= $textbox->render() ?>


The Label enables you to associate the label HTML element with a TextBox.

The example below demonstrates how to add a floating label to a TextBox.

    $label = new \Kendo\UI\TextBoxLabel();

    $textbox = new \Kendo\UI\TextBox('textbox');

        .k-floating-label-container {
            width: 100%;

Event Handling

You can subscribe to the change event by the handler name. The change fires each time a new value is set by the user. For a full list, refer to the TextBox events documentation in the API section.

Important: The change event is not fired when the value of the widget is changed from JavaScript code.

Specify Function Names

The example below demonstrates how to subscribe for events by specifying a JavaScript function name.

$textbox = new \Kendo\UI\TextBox('textbox');
    ->attr('style', 'width: 100%');

    function onChange() {
        console.log("Change :: " + this.value());


Client-Side Instances

To reference to an existing TextBox instance, use the jQuery.data() method. Once a reference is established, use the API to control its behavior.

The following example demonstrates how to access an existing TextBox instance.

    $textbox = new \Kendo\UI\TextBox('textbox');

        $(function() {
            // The constructor parameter is used as the 'id' HTML attribute of the textbox
            var textbox = $("#textbox").data("kendoTextBox");

See Also

In this article