Input Manager and Invalid Javascript Validation Code

2 posts, 0 answers
  1. Ed
    Ed avatar
    24 posts
    Member since:
    May 2005

    Posted 05 Mar 2012 Link to this post

    I have a contact us form that has been built and uses a RadInputManager to validate the input client side. The JavaScript that is created by the Input Manager seems to be invalid JavaScript as the variable name it uses are just numbers, e.g. var 0 = ...., and var 1 = ...

    I have put a test page together which just includes two textboxes and a submit button to demostrate this. To view the page see The HTML for the page is also below.

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="test.aspx.vb" Inherits="test" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <head runat="server">
        <form id="form1" runat="server">
            <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            <telerik:RadInputManager ID="RadInputManager1" runat="server" EnableEmbeddedSkins="True"
                <telerik:TextBoxSetting ClearValueOnError="False" EmptyMessage="Full name"
                    ErrorMessage="Your full name is required">
                        <telerik:TargetInput ControlID="fdFullName" />
                    <Validation IsRequired="True" ValidationGroup="ContactUs" />
                <telerik:RegExpTextBoxSetting ClearValueOnError="False" EmptyMessage="Please enter your email address"
                    ErrorMessage="A valid email address is required" ValidationExpression="[^@]+@[^\.]+\..+">
                        <telerik:TargetInput ControlID="fdEmailAddress" />
                    <Validation IsRequired="True" ValidationGroup="ContactUs" />
            <asp:TextBox ID="fdFullName" runat="server" ValidationGroup="ContactUs"></asp:TextBox>
            <br /><br />
            <asp:TextBox ID="fdEmailAddress" runat="server" ValidationGroup="ContactUs"></asp:TextBox>
            <asp:Button ID="btnSubmit" runat="server" Text="Submit" ValidationGroup="ContactUs" />

    The Javascript error that I get is

    Error: missing variable name
    Source File:
    Line: 79, Column: 4
    Source Code:
    var 0 = document.all ? document.all["0"] : document.getElementById("0");

    I believe this is because variable names in JavaScript must begin with a letter, $ or _ to be valid. Is there something I need to add to the Input Manager to fix the problem?

  2. Ed
    Ed avatar
    24 posts
    Member since:
    May 2005

    Posted 06 Mar 2012 Link to this post

    I have found the problem, in the web.config we had set the clientIdMode to static removing this has solved the problem.
Back to Top