OTPInput Autopostback - workaround or in future update?

1 Answer 9 Views
Ajax Input OTPInput
Nick
Top achievements
Rank 1
Nick asked on 13 Sep 2025, 06:53 PM
I don't think OTPInput control has an autopostback and so I am using this code to call client event then do post back via hidden link button to my server side function. This is used for allowing a user to enter a three digit entry key number and doesn't require them to enter the numbers and press a button for speed. If the control had autopostback when all boxes have a value and the last box value is entered this would make the control much more useful. Is there a better way of doing this?

<telerik:RadScriptManager ID="RadScriptManager1" runat="server" />

<!-- OTP input for three digit key number-->
<telerik:RadOTPInput ID="otpKeySearch" runat="server" Placeholder="0-9" Space="true" Type="Number">
    <Items>
        <telerik:OTPInputItem GroupLength="3" />
    </Items>
    <ClientEvents OnChange="keyOTPOnChange" />
</telerik:RadOTPInput>

<!-- Hidden linkbutton we will post back to -->
<asp:LinkButton ID="btnOtpPostBack"
                runat="server"
                OnClick="otpKeySearchChanged"
                UseSubmitBehavior="false"
                Style="display:none;" />

<script type="text/javascript">
    // Fires every time the OTP value changes
    function keyOTPOnChange(sender, args) {
        var value = args.get_value() || "";
        // Only act once we have exactly three digits 0-9
        if (value.length === 3 && /^\d{3}$/.test(value)) {
            // Force a full postback to the hidden LinkButton
            __doPostBack('<%= btnOtpPostBack.UniqueID %>', '');
        }
    }
</script>

    ' Handles the hidden LinkButton postback
    Protected Sub otpKeySearchChanged(sender As Object, e As EventArgs) Handles btnOtpPostBack.Click
        Dim theKeyNumber As String = ""
        If otpKeySearch IsNot Nothing AndAlso otpKeySearch.Value IsNot Nothing Then
            theKeyNumber = otpKeySearch.Value.Trim()
        End If
        If theKeyNumber <> "" AndAlso theKeyNumber.Length = 3 AndAlso IsNumeric(theKeyNumber) Then
            ' get key number from database and perform redirect to keys panel of relevant entry dashboard
        End If
        ' If we got here (redirect above failed - value was invalid or key not found in database) show the radNotify with message to user
        notifyInvalidSearch.Show()
    End Sub

1 Answer, 1 is accepted

Sort by
0
Vasko
Telerik team
answered on 15 Sep 2025, 06:17 AM

Hi Nick,

Thank you for bringing our attention to this matter.

As you probably know, the WebForms OTP Input control is a server-side wrapper of the Kendo UI for jQuery OTP Input, which means it uses the same client-side logic used in Kendo, therefore there is no AutoPostBack property.

I have inspected your workaround and so far it appears to "do the job" for your scenario, however, if you think this should be a built-in feature of the OTP Input, I strongly suggest you open a Feature Request on our Feedback Portal.

Regards,
Vasko
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Telerik family, check out our getting started resources
Tags
Ajax Input OTPInput
Asked by
Nick
Top achievements
Rank 1
Answers by
Vasko
Telerik team
Share this question
or