CaptchaBuilder

Properties

WriteAction - Func

Methods

CaptchaImage(System.String)

Specifies the source of an image to be rendered in the Captcha initially. If the option is not defined, the handler that resets the image will be called.

Parameters

captchaImage - System.String

The value that configures the image.

RETURNS

Returns the current CaptchaBuilder instance.

Example

Razor
 
                @(Html.Kendo().Captcha()
                   .Name("captcha")
                   .CaptchaImage((string)ViewData["CaptchaImage"])
                   .DataCaptchaField("Captcha")
                   .DataCaptchaIdField("CaptchaID")
                   .Handler(handler => handler.Action("Reset", "Captcha"))
                )
             

AudioHandler(System.Action)

The URL or AJAX settings that fetches the audio of the captcha.

Parameters

configurator - System.Action<CrudOperationBuilder>

The action that configures the audio settings.

RETURNS

Returns the current CaptchaBuilder instance.

Example

Razor
 
             @(Html.Kendo().Captcha()
                 .Name("captcha")
                 .AudioHandler(x => x.Action("GetAudio","Captcha").Data("additionalParameters"))
             )
             

AudioHandler(System.String)

Defines the URL that fetches the audio of the captcha.

Parameters

url - System.String

The URL that returns the audio source.

RETURNS

Returns the current CaptchaBuilder instance.

Example

Razor
 
             @(Html.Kendo().Captcha()
                 .Name("captcha")
                 .AudioHandler("url-to-audio")
             )
             

AudioHandlerFunction(System.String)

The JavaScript function that fetches the audio of the captcha. Within the function, call the "args.success" method with the source of the audio (base64 stream).

Parameters

handler - System.String

The JavaScript function that returns the source of the audio.

RETURNS

Returns the current CaptchaBuilder instance.

Example

Razor
 
             @(Html.Kendo().Captcha()
                 .Name("captcha")
                 .AudioHandlerFunction("audioHandler")
             )
            <script>
                function audioHandler(args) {
                    args.success("@Url.Action("GetAudio", "Captcha")?captchaId=" + args.data.CaptchaID);
                }
            </script>
             

Handler(System.Action)

Defines the URL or AJAX settings that fetches the captcha image and id. The request triggers initially when the CaptchaImage() and CaptchaId() options are not defined to request the captcha and when the "Reset" button is clicked.

Parameters

configurator - System.Action<CrudOperationBuilder>

The action that configures the endpoint to return the image initially or when resetting the Captcha.

RETURNS

Returns the current CaptchaBuilder instance.

Example

Razor
 
             @(Html.Kendo().Captcha()
                 .Name("captcha")
                 .Handler(handler => handler.Action("GetCaptcha", "Captcha").Data("additionalParameters"))
             )
             

Handler(System.String)

Defines the URL that fetches the captcha image and id.

Parameters

url - System.String

The URL that returns the captcha image and id.

RETURNS

Returns the current CaptchaBuilder instance.

Example

Razor
 
             @(Html.Kendo().Captcha()
                 .Name("captcha")
                 .Handler("url-to-captcha")
             )
             

HandlerFunction(System.String)

The JavaScript function that fetches the captcha image and id. Within the function, call the "args.success()" method with the received captcha image and id.

Parameters

handler - System.String

The JavaScript function that returns the captcha image and id.

RETURNS

Returns the current CaptchaBuilder instance.

Example

Razor
 
             @(Html.Kendo().Captcha()
                 .Name("captcha")
                 .DataCaptchaField("Captcha")
                 .DataCaptchaIdField("CaptchaID")
                 .HandlerFunction("getCaptcha")
             )
            <script>
                function getCaptcha(args) {
                  $.ajax({
                    type: "GET",
                    url: '@Url.Action("Reset","Captcha")',
                    success: function(data) {
                      args.success({
                        Captcha: data.Captcha,
                        CaptchaID: data.CaptchaID
                      });
                    }
                  });
                }
            </script>
             

ValidationHandler(System.Action)

Defines the URL or AJAX settings that validates the text input of the Captcha.

Parameters

configurator - System.Action<CrudOperationBuilder>

The action that configures the validation of the Captcha.

RETURNS

Returns the current CaptchaBuilder instance.

Example

Razor
 
             @(Html.Kendo().Captcha()
                 .Name("captcha")
                 .ValidationHandler(handler => handler.Action("ValidateCaptcha", "Captcha"))
             )
             

ValidationHandler(System.String)

Defines the URL of the endpoint that validates the text input of the Captcha.

Parameters

url - System.String

The URL of the endpoint.

RETURNS

Returns the current CaptchaBuilder instance.

Example

Razor
 
             @(Html.Kendo().Captcha()
                 .Name("captcha")
                 .ValidationHandler("url-to-validate-captcha")
             )
             

ValidationHandlerFunction(System.String)

The JavaScript function that validates the text input of the Captcha. Within the function, call the "args.success()" method with the boolean value indicating whether the validation passed successfully.

Parameters

handler - System.String

The JavaScript function that validates the Captcha.

RETURNS

Returns the current CaptchaBuilder instance.

Example

Razor
 
             @(Html.Kendo().Captcha()
                 .Name("captcha")
                 .DataCaptchaField("Captcha")
                 .DataCaptchaIdField("CaptchaID")
                 .ValidationHandlerFunction("validateCaptcha")
             )
            <script>
                function validateCaptcha(args) {
                  $.ajax({
                    type: "GET",
                    url: `captcha/validate?CaptchaID=${args.data.CaptchaID}&Captcha=${args.data.Captcha}`,
                    success: function(result) {
                      args.success(result);
                    }
                  });
                }
            </script>
             

AudioButton(System.Boolean)

Toggles the audio button.

Parameters

value - System.Boolean

The value for AudioButton

RETURNS

Returns the current CaptchaBuilder instance.

CaptchaId(System.String)

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.

Parameters

value - System.String

The value for CaptchaId

RETURNS

Returns the current CaptchaBuilder instance.

DataCaptchaField(System.String)

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

Parameters

value - System.String

The value for DataCaptchaField

RETURNS

Returns the current CaptchaBuilder instance.

DataCaptchaIdField(System.String)

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

Parameters

value - System.String

The value for DataCaptchaIdField

RETURNS

Returns the current CaptchaBuilder instance.

Messages(System.Action)

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

Parameters

configurator - System.Action<CaptchaMessagesSettingsBuilder>

The configurator for the messages setting.

RETURNS

Returns the current instance of CaptchaBuilder .

ResetButton(System.Boolean)

Toggles the reset button.

Parameters

value - System.Boolean

The value for ResetButton

RETURNS

Returns the current CaptchaBuilder instance.

ValidateOnBlur(System.Boolean)

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.

Parameters

value - System.Boolean

The value for ValidateOnBlur

RETURNS

Returns the current CaptchaBuilder instance.

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

Returns the current CaptchaBuilder instance.

VolumeControl(System.Boolean)

Whether to show a volume control when audio is played.

Parameters

value - System.Boolean

The value for VolumeControl

RETURNS

Returns the current CaptchaBuilder instance.

Events(System.Action)

Configures the client-side events.

Parameters

configurator - System.Action<CaptchaEventBuilder>

The client events action.

RETURNS

Returns the current CaptchaBuilder instance.

Example

Razor
 
            @(Html.Kendo().Captcha()
                  .Name("Captcha")
                  .Events(events => events
                      .Change("onChange")
                  )
            )
             

ToComponent()

Returns the internal view component.

RETURNS

The instance that represents the component.

Expression(System.String)

Sets the name of the component.

Parameters

modelExpression - System.String

RETURNS

Returns the current instance.

Explorer(Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer)

Sets the name of the component.

Parameters

modelExplorer - Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer

RETURNS

Returns the current instance.

Name(System.String)

Sets the name of the component.

Parameters

componentName - System.String

The name.

RETURNS

Returns the current instance.

Deferred(System.Boolean)

Suppress initialization script rendering. Note that this options should be used in conjunction with

Parameters

deferred - System.Boolean

RETURNS

Returns a DeferredWidgetBuilder instance.

HtmlAttributes(System.Object)

Sets the HTML attributes.

Parameters

attributes - System.Object

The HTML attributes.

RETURNS

Returns the current instance.

HtmlAttributes(System.Collections.Generic.IDictionary)

Sets the HTML attributes.

Parameters

attributes - System.Collections.Generic.IDictionary<String,Object>

The HTML attributes.

RETURNS

Returns the current instance.

ScriptAttributes(System.Object,System.Boolean)

Sets the JavaScript attributes to the initialization script.

Parameters

attributes - System.Object

The JavaScript attributes.

overrideAttributes - System.Boolean

Argument which determines whether attributes should be overriden.

RETURNS

Returns the current instance.

ScriptAttributes(System.Collections.Generic.IDictionary,System.Boolean)

Sets the JavaScript attributes to the initialization script.

Parameters

attributes - System.Collections.Generic.IDictionary<String,Object>

The JavaScript attributes.

overrideAttributes - System.Boolean

Argument which determines whether attributes should be overriden.

RETURNS

Returns the current instance.

Render()

Renders the component in place.

ToHtmlString()

Returns the HTML representation of the component.

WriteTo(System.IO.TextWriter,System.Text.Encodings.Web.HtmlEncoder)

Parameters

writer - System.IO.TextWriter
encoder - System.Text.Encodings.Web.HtmlEncoder

ToClientTemplate()

Returns the client template for the component.

AsModule(System.Boolean)

Specifies whether the initialization script of the component will be rendered as a JavaScript module.

Parameters

value - System.Boolean

RETURNS

Returns the current instance.