New to Telerik UI for ASP.NET Core? Start a free 30-day trial

Defines the fluent API for configuring the Telerik UI for ASP.NET Core Captcha

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Syntax:

C#
public class CaptchaBuilder : WidgetBuilderBase<Captcha, CaptchaBuilder>, IHtmlContent

Inheritance: objectHelperResultWidgetBuilderBase<Captcha, CaptchaBuilder>CaptchaBuilder

Implements: IHtmlContent

Inherited Members WidgetBuilderBase<Captcha, CaptchaBuilder>.ToComponent()WidgetBuilderBase<Captcha, CaptchaBuilder>.Expression(string)WidgetBuilderBase<Captcha, CaptchaBuilder>.Explorer(ModelExplorer)WidgetBuilderBase<Captcha, CaptchaBuilder>.Name(string)WidgetBuilderBase<Captcha, CaptchaBuilder>.Deferred(bool)WidgetBuilderBase<Captcha, CaptchaBuilder>.HtmlAttributes(object)WidgetBuilderBase<Captcha, CaptchaBuilder>.HtmlAttributes(IDictionary<string, object>)WidgetBuilderBase<Captcha, CaptchaBuilder>.ScriptAttributes(object, bool)WidgetBuilderBase<Captcha, CaptchaBuilder>.ScriptAttributes(IDictionary<string, object>, bool)WidgetBuilderBase<Captcha, CaptchaBuilder>.Render()WidgetBuilderBase<Captcha, CaptchaBuilder>.ToHtmlString()WidgetBuilderBase<Captcha, CaptchaBuilder>.WriteTo(TextWriter, HtmlEncoder)WidgetBuilderBase<Captcha, CaptchaBuilder>.ToClientTemplate()WidgetBuilderBase<Captcha, CaptchaBuilder>.AsModule(bool)WidgetBuilderBase<Captcha, CaptchaBuilder>.ComponentWidgetBuilderBase<Captcha, CaptchaBuilder>.ContainerHelperResult.WriteTo(TextWriter, HtmlEncoder)HelperResult.WriteActionobject.GetType()object.MemberwiseClone()object.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()...

Constructors

Initializes a new instance of the CaptchaBuilder class.

C#
public CaptchaBuilder(Captcha component)
Parameters:componentCaptcha

Methods

Toggles the audio button.

C#
public CaptchaBuilder AudioButton(bool value)
Parameters:valuebool

The value for AudioButton

Returns:

CaptchaBuilder

Returns the current CaptchaBuilder instance.

Example:
C#
@(Html.Kendo().Captcha()
.Name("captcha")
.AudioButton(false)
)

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

C#
public CaptchaBuilder AudioHandler(Action<CrudOperationBuilder> configurator)
Parameters:configuratorAction<CrudOperationBuilder>

The action that configures the audio settings.

Returns:

CaptchaBuilder

Returns the current CaptchaBuilder instance.

Example:
C#
@(Html.Kendo().Captcha()
.Name("captcha")
.AudioHandler(x =&gt; x.Action("GetAudio","Captcha").Data("additionalParameters"))
)

Defines the URL that fetches the audio of the captcha.

C#
public CaptchaBuilder AudioHandler(string url)
Parameters:urlstring

The URL that returns the audio source.

Returns:

CaptchaBuilder

Returns the current CaptchaBuilder instance.

Example:
C#
@(Html.Kendo().Captcha()
.Name("captcha")
.AudioHandler("url-to-audio")
)

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).

C#
public CaptchaBuilder AudioHandlerFunction(string handler)
Parameters:handlerstring

The JavaScript function that returns the source of the audio.

Returns:

CaptchaBuilder

Returns the current CaptchaBuilder instance.

Example:
C#
@(Html.Kendo().Captcha()
.Name("captcha")
.AudioHandlerFunction("audioHandler")
)
&lt;script&gt;
function audioHandler(args) {
args.success("@Url.Action("GetAudio", "Captcha")?captchaId=" + args.data.CaptchaID);
}
&lt;/script&gt;

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.

C#
public CaptchaBuilder CaptchaId(string value)
Parameters:valuestring

The value for CaptchaId

Returns:

CaptchaBuilder

Returns the current CaptchaBuilder instance.

Example:
C#
@(Html.Kendo().Captcha()
.Name("captcha")
.CaptchaId((string)ViewData["CaptchaID"])
)

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.

C#
public CaptchaBuilder CaptchaImage(string captchaImage)
Parameters:captchaImagestring

The value that configures the image.

Returns:

CaptchaBuilder

Returns the current CaptchaBuilder instance.

Example:
C#
@(Html.Kendo().Captcha()
.Name("captcha")
.CaptchaImage((string)ViewData["CaptchaImage"])
.DataCaptchaField("Captcha")
.DataCaptchaIdField("CaptchaID")
.Handler(handler =&gt; handler.Action("Reset", "Captcha"))
)

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

C#
public CaptchaBuilder DataCaptchaField(string value)
Parameters:valuestring

The value for DataCaptchaField

Returns:

CaptchaBuilder

Returns the current CaptchaBuilder instance.

Example:
C#
@(Html.Kendo().Captcha()
.Name("captcha")
.DataCaptchaField("CaptchaImage")
)

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

C#
public CaptchaBuilder DataCaptchaIdField(string value)
Parameters:valuestring

The value for DataCaptchaIdField

Returns:

CaptchaBuilder

Returns the current CaptchaBuilder instance.

Example:
C#
@(Html.Kendo().Captcha()
.Name("captcha")
.DataCaptchaIdField("CaptchaID")
)

Configures the client-side events.

C#
public CaptchaBuilder Events(Action<CaptchaEventBuilder> configurator)
Parameters:configuratorAction<CaptchaEventBuilder>

The client events action.

Returns:

CaptchaBuilder

Returns the current CaptchaBuilder instance.

Example:
C#
@(Html.Kendo().Captcha()
.Name("Captcha")
.Events(events =&gt; events
.Change("onChange")
)
)

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.

C#
public CaptchaBuilder Handler(Action<CrudOperationBuilder> configurator)
Parameters:configuratorAction<CrudOperationBuilder>

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

Returns:

CaptchaBuilder

Returns the current CaptchaBuilder instance.

Example:
C#
@(Html.Kendo().Captcha()
.Name("captcha")
.Handler(handler =&gt; handler.Action("GetCaptcha", "Captcha").Data("additionalParameters"))
)

Defines the URL that fetches the captcha image and id.

C#
public CaptchaBuilder Handler(string url)
Parameters:urlstring

The URL that returns the captcha image and id.

Returns:

CaptchaBuilder

Returns the current CaptchaBuilder instance.

Example:
C#
@(Html.Kendo().Captcha()
.Name("captcha")
.Handler("url-to-captcha")
)

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.

C#
public CaptchaBuilder HandlerFunction(string handler)
Parameters:handlerstring

The JavaScript function that returns the captcha image and id.

Returns:

CaptchaBuilder

Returns the current CaptchaBuilder instance.

Example:
C#
@(Html.Kendo().Captcha()
.Name("captcha")
.DataCaptchaField("Captcha")
.DataCaptchaIdField("CaptchaID")
.HandlerFunction("getCaptcha")
)
&lt;script&gt;
function getCaptcha(args) {
$.ajax({
type: "GET",
url: '@Url.Action("Reset","Captcha")',
success: function(data) {
args.success({
Captcha: data.Captcha,
CaptchaID: data.CaptchaID
});
}
});
}
&lt;/script&gt;

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

C#
public CaptchaBuilder Messages(Action<CaptchaMessagesSettingsBuilder> configurator)
Parameters:configuratorAction<CaptchaMessagesSettingsBuilder>

The CaptchaMessagesSettingsBuilder for the messages setting.

Returns:

CaptchaBuilder

Returns the current instance of CaptchaBuilder .

Toggles the reset button.

C#
public CaptchaBuilder ResetButton(bool value)
Parameters:valuebool

The value for ResetButton

Returns:

CaptchaBuilder

Returns the current CaptchaBuilder instance.

Example:
C#
@(Html.Kendo().Captcha()
.Name("captcha")
.ResetButton(false)
)

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.

C#
public CaptchaBuilder ValidateOnBlur()
Returns:

CaptchaBuilder

Returns the current CaptchaBuilder instance.

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.

C#
public CaptchaBuilder ValidateOnBlur(bool value)
Parameters:valuebool

The value for ValidateOnBlur

Returns:

CaptchaBuilder

Returns the current CaptchaBuilder instance.

Example:
C#
@(Html.Kendo().Captcha()
.Name("captcha")
.ValidateOnBlur(true)
)

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

C#
public CaptchaBuilder ValidationHandler(Action<CrudOperationBuilder> configurator)
Parameters:configuratorAction<CrudOperationBuilder>

The action that configures the validation of the Captcha.

Returns:

CaptchaBuilder

Returns the current CaptchaBuilder instance.

Example:
C#
@(Html.Kendo().Captcha()
.Name("captcha")
.ValidationHandler(handler =&gt; handler.Action("ValidateCaptcha", "Captcha"))
)

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

C#
public CaptchaBuilder ValidationHandler(string url)
Parameters:urlstring

The URL of the endpoint.

Returns:

CaptchaBuilder

Returns the current CaptchaBuilder instance.

Example:
C#
@(Html.Kendo().Captcha()
.Name("captcha")
.ValidationHandler("url-to-validate-captcha")
)

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.

C#
public CaptchaBuilder ValidationHandlerFunction(string handler)
Parameters:handlerstring

The JavaScript function that validates the Captcha.

Returns:

CaptchaBuilder

Returns the current CaptchaBuilder instance.

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

Whether to show a volume control when audio is played.

C#
public CaptchaBuilder VolumeControl(bool value)
Parameters:valuebool

The value for VolumeControl

Returns:

CaptchaBuilder

Returns the current CaptchaBuilder instance.

Example:
C#
@(Html.Kendo().Captcha()
.Name("captcha")
.VolumeControl(false)
)