New to Telerik UI for PHP? Download free 30-day trial

\Kendo\UI\Captcha

A PHP wrapper for Kendo UI Captcha.

Inherits from \Kendo\UI\Widget.

Usage

To use Captcha in a PHP page instantiate a new instance, configure it via the available configuration methods and output it by echo-ing the result of the render method.

Using Kendo Captcha

<?php
// Create a new instance of Captcha and specify its id
$captcha = new \Kendo\UI\Captcha('Captcha');

// Configure it
$captcha->audioButton(true)

// Output it

echo $captcha->render();
?>

Methods

audioButton

Toggles the audio button.

Returns

\Kendo\UI\Captcha

Parameters

$value boolean

Example

<?php
$captcha = new \Kendo\UI\Captcha('Captcha');
$captcha->audioButton(true);
?>

audioHandler

The URL, AJAX settings or function that fetches the audio of the captcha. When used with function, call the args.success method with the source of the audio.

Returns

\Kendo\UI\Captcha

Parameters

$value string|\Kendo\JavaScriptFunction|

Example - using string

<?php
$captcha = new \Kendo\UI\Captcha('Captcha');
$captcha->audioHandler('value');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$captcha = new \Kendo\UI\Captcha('Captcha');
$captcha->audioHandler(new \Kendo\JavaScriptFunction('function() { }'));
?>

captcha

The source of an image to be rendered as captcha initially. If not set the handler to reset the image will be called.

Returns

\Kendo\UI\Captcha

Parameters

$value string

Example

<?php
$captcha = new \Kendo\UI\Captcha('Captcha');
$captcha->captcha('value');
?>

captchaId

The ID of the captcha to be added to the hidden input initially. If not set the handler to reset the ID will be called.

Returns

\Kendo\UI\Captcha

Parameters

$value string

Example

<?php
$captcha = new \Kendo\UI\Captcha('Captcha');
$captcha->captchaId('value');
?>

change

Fired when users changes the input of the Captcha component. For additional information check the change event documentation.

Returns

\Kendo\UI\Captcha

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$captcha = new \Kendo\UI\Captcha('Captcha');
$captcha->change('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onChange(e) {
        // handle the change event.
    }
</script>
<?php
$captcha = new \Kendo\UI\Captcha('Captcha');
$captcha->change('onChange');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$captcha = new \Kendo\UI\Captcha('Captcha');
$captcha->change(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

dataCaptchaField

The field that returns the captcha's image source. Used in the handler function/response that resets the captcha's image and id.

Returns

\Kendo\UI\Captcha

Parameters

$value string

Example

<?php
$captcha = new \Kendo\UI\Captcha('Captcha');
$captcha->dataCaptchaField('value');
?>

dataCaptchaIdField

The field that returns the captcha's id. Used in the handler function/response that resets the captcha's image and id.

Returns

\Kendo\UI\Captcha

Parameters

$value string

Example

<?php
$captcha = new \Kendo\UI\Captcha('Captcha');
$captcha->dataCaptchaIdField('value');
?>

error

Fired when a request triggered by the component fails - can be distinguished via the type argument in the event data. For additional information check the error event documentation.

Returns

\Kendo\UI\Captcha

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$captcha = new \Kendo\UI\Captcha('Captcha');
$captcha->error('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onError(e) {
        // handle the error event.
    }
</script>
<?php
$captcha = new \Kendo\UI\Captcha('Captcha');
$captcha->error('onError');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$captcha = new \Kendo\UI\Captcha('Captcha');
$captcha->error(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

handler

The URL, AJAX settings or function that fetches the image and id of the captcha. Called initially when no captcha and captchaId options are entered and when the Reset button is pressed. When used with function, call the args.success method with the source of the audio.

Returns

\Kendo\UI\Captcha

Parameters

$value string|\Kendo\JavaScriptFunction|

Example - using string

<?php
$captcha = new \Kendo\UI\Captcha('Captcha');
$captcha->handler('value');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$captcha = new \Kendo\UI\Captcha('Captcha');
$captcha->handler(new \Kendo\JavaScriptFunction('function() { }'));
?>

messages

Provides configuration options for the messages present in the Captcha widget.

Returns

\Kendo\UI\Captcha

Parameters

$value \Kendo\UI\CaptchaMessages|array

Example - using \Kendo\UI\CaptchaMessages

<?php
$captcha = new \Kendo\UI\Captcha('Captcha');
$messages = new \Kendo\UI\CaptchaMessages();
$audio = 'value';
$messages->audio($audio);
$captcha->messages($messages);
?>

Example - using array

<?php
$captcha = new \Kendo\UI\Captcha('Captcha');
$audio = 'value';
$captcha->messages(array('audio' => $audio));
?>

requestEnd

Fired when a request to a handler is finished - can be distinguished via the type argument in the event data. For additional information check the requestEnd event documentation.

Returns

\Kendo\UI\Captcha

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$captcha = new \Kendo\UI\Captcha('Captcha');
$captcha->requestEnd('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onRequestEnd(e) {
        // handle the requestEnd event.
    }
</script>
<?php
$captcha = new \Kendo\UI\Captcha('Captcha');
$captcha->requestEnd('onRequestEnd');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$captcha = new \Kendo\UI\Captcha('Captcha');
$captcha->requestEnd(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

requestStart

Fired when the captcha makes a request to a handler - can be distinguished via the type argument in the event data. For additional information check the requestStart event documentation.

Returns

\Kendo\UI\Captcha

Parameters

$value string|\Kendo\JavaScriptFunction

Example - using string which defines a JavaScript function

<?php
$captcha = new \Kendo\UI\Captcha('Captcha');
$captcha->requestStart('function(e) { }');
?>

Example - using string which defines a JavaScript name

<script>
    function onRequestStart(e) {
        // handle the requestStart event.
    }
</script>
<?php
$captcha = new \Kendo\UI\Captcha('Captcha');
$captcha->requestStart('onRequestStart');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$captcha = new \Kendo\UI\Captcha('Captcha');
$captcha->requestStart(new \Kendo\JavaScriptFunction('function(e) { }'));
?>

resetButton

Toggles the reset button.

Returns

\Kendo\UI\Captcha

Parameters

$value boolean

Example

<?php
$captcha = new \Kendo\UI\Captcha('Captcha');
$captcha->resetButton(true);
?>

validateOnBlur

Whether to trigger validation when input is blurred. This option is useful if you are not using the Kendo Validator or the Kendo Form widgets as it enables to automatically trigger remote validation and use the widet's API in custom validation scenario.

Returns

\Kendo\UI\Captcha

Parameters

$value boolean

Example

<?php
$captcha = new \Kendo\UI\Captcha('Captcha');
$captcha->validateOnBlur(true);
?>

validationHandler

The URL, AJAX settings or function that validates the text input. When used with function, call the args.success method with boolean value.

Returns

\Kendo\UI\Captcha

Parameters

$value string|\Kendo\JavaScriptFunction|

Example - using string

<?php
$captcha = new \Kendo\UI\Captcha('Captcha');
$captcha->validationHandler('value');
?>

Example - using \Kendo\JavaScriptFunction

<?php
$captcha = new \Kendo\UI\Captcha('Captcha');
$captcha->validationHandler(new \Kendo\JavaScriptFunction('function() { }'));
?>

volumeControl

Whether to show a volume control when audio is played.

Returns

\Kendo\UI\Captcha

Parameters

$value boolean

Example

<?php
$captcha = new \Kendo\UI\Captcha('Captcha');
$captcha->volumeControl(true);
?>
In this article
Not finding the help you need?