Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Mar 2013
    Posts
    16
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Line: 172 and Error: 'length' is null or not an object in jquery datetimepicker

    Hi,
    I am facing an error with the jquerydatetimepicker, I have checked the net and it is caused by the asp.net validator. I have followed some of the forums reply and have set this in my javascript

    Code:
    <script type="text/javascript">
       
       $(function pageLoad() 
    {
    
        $("[id$=fromdtext]").datetimepicker({
        dateFormat: 'dd/mm/yy', onSelect: function() {
            if (datetimepicker.input[0].onchange.toString().match(/^[^(]+\(\)\s*{\s*ValidatorOnChange\(event\);\s*}\s*$/)) {
                datetimepicker.input[0].onchange = ValidatorOnChange;
            }
            datetimepicker.input.trigger("change");
        }
        });
    });
    
    
       </script>

    and my asp code
    Code:
    <asp:TemplateField HeaderText="From Date/Time">
            <ItemTemplate>
            <asp:TextBox ID="fromdtext" runat="server" MaxLength="50" Width="120px" ></asp:TextBox>
           <asp:RequiredFieldValidator ID="validfromdtext" runat="server" ControlToValidate="fromdtext"
            ErrorMessage="*" SetFocusOnError="True"></asp:RequiredFieldValidator>
           </ItemTemplate>
           </asp:TemplateField>
    yet i still receive the error in the subject above, any idea how to overcome this issue

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,603
    Thanks
    0
    Thanked 645 Times in 635 Posts
    Perhaps moving the JavaScript into a separate file will help.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #3
    New Coder
    Join Date
    Mar 2013
    Posts
    16
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Hi

    Tried that, still da same.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •