[CLOSED] DatePickerField - Javascript error

  1. #1

    [CLOSED] DatePickerField - Javascript error

    Hi, when clicking the date-picker to select a date I get a javascript error "Uncaught TypeError: Cannot read property 'add' of undefined", is there a way around it?

    @using Ext.Net.Mobile;
    @using Ext.Net.Mobile.MVC;
    @{
        Layout = null;
        var x = Html.X();
    }
    <!DOCTYPE html>
    <html>
    <head>
        <title>Test DatePickerField</title>
    </head>
    <body>
        @Html.X().ResourceManager() 
        @(
            x.Panel()
            .Height(50)
            .Items(
                x.DatePickerField()
                    .Label("Date")
                    .DestroyPickerOnHide(true)
                    .Name("date")
                    .Picker(
                        x.DatePicker()
                            .YearFrom(1990)
                            .DateValue(new DateTime(2016, 6, 24))
                    )
            )
        )
    </body>
    </html>
    Last edited by fabricio.murta; Feb 25, 2017 at 4:53 AM.
  2. #2
    Interesting, @sveins12! Your DatePickerField is defined exactly like the one on the corresponding MVC example (User Interface > Forms > Form Panel), and it works fine!

    It is the 5th field in the example, called Start Date. Can you give the example a try? Does it break on your browser? I just tested it here using chrome in device emulation mode, emulating a Galaxy S5. Maybe there's a specific browser or platform to reproduce the issue?
    Fabrício Murta
    Developer & Support Expert
  3. #3
    In the example it works fine. But when I took the code out of the example it fails. I have tried several ways and with more fields and so on, but I cannot get it to work.

    I am using Chrome version 56.0.2924.76 (64-bit).

    Here is the stack trace:

    Uncaught TypeError: Cannot read property 'add' of undefined
    at constructor.show (ext-mobile.axd?v=4.1.0:83736)
    at constructor.onFocus (ext-mobile.axd?v=4.1.0:84231)
    at constructor.onMaskTap (ext-mobile.axd?v=4.1.0:83206)
    at constructor.fire (ext-mobile.axd?v=4.1.0:12622)
    at constructor.doFireEvent (ext-mobile.axd?v=4.1.0:13258)
    at constructor.doFireEvent (ext-mobile.axd?v=4.1.0:26167)
    at constructor.prototype.doFireEvent (ext-mobile.axd?v=4.1.0:28224)
    at constructor.fireEventArgs (ext-mobile.axd?v=4.1.0:13164)
    at constructor.fireAction (ext-mobile.axd?v=4.1.0:13179)
    at constructor.onMaskTap (ext-mobile.axd?v=4.1.0:76257)
    Last edited by sveins12; Feb 02, 2017 at 4:03 AM.
  4. #4
    I figured out now, thanks to FireFox. That browser gave a better message: "TypeError: Ext.Viewport is undefined".

    So when I added a viewport it worked.
  5. #5
    Oh, sure... the viewport!

    Alternatively you can just add a main panel (or fieldset) if that's going to be the only in the page, and give it a Fullscreen="true" setting. It is like a shorthand to setting up the viewport.

    Thanks for the feedback and glad you could find the reason the page was breaking!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 4
    Last Post: Nov 04, 2016, 4:17 AM
  2. [CLOSED] JavaScript Error
    By canbay in forum 1.x Premium Help
    Replies: 1
    Last Post: Aug 29, 2012, 11:32 AM
  3. Handler javascript's Error
    By Krisller in forum 1.x Help
    Replies: 3
    Last Post: Jun 17, 2010, 2:33 PM
  4. [CLOSED] javascript error
    By alexp in forum 1.x Premium Help
    Replies: 7
    Last Post: Mar 12, 2009, 11:59 AM
  5. [CLOSED] SVN JavaScript error
    By Timothy in forum 1.x Premium Help
    Replies: 2
    Last Post: Sep 11, 2008, 7:53 PM

Posting Permissions