jQuery UI Widgets Forums Editors Input, Password Input, TextArea, ColorPicker, Rating, TagCloud, Loader Object doesn't support property or method 'toUpperCase'

Tagged: 

This topic contains 5 replies, has 3 voices, and was last updated by  Gab 11 years, 8 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author

  • kevin_wkw
    Participant

    Hi,

    I was trying to implement jqxInput with json. However, when I type something in the input box, it throws an error, “Object doesn’t support property or method ‘toUpperCase’ “. This is a MVC 4 solution and the json data is correct. Please help. Thanks.

    SCRIPT438: Object doesn’t support property or method ‘toUpperCase’
    jqx-all.js, line 7 character 20541

    // prepare the data
    var source =
    {
    datatype: 'json',
    datafields: [
    { name: 'Field', type: 'string' },
    { name: 'FieldId', type: 'string' },
    ],
    url: '/Fields/FetchItems/'
    };
    var dataAdapter = new $.jqx.dataAdapter(source);
    // Create a jqxInput
    $("#input_field").jqxInput({ source: dataAdapter, placeHolder: "Enter:", displayMember: "Field", valueMember: "FieldId", theme: theme });
    $("#input_field").on('select', function (event) {
    if (event.args) {
    var item = event.args.item;
    if (item) {
    var valueelement = $("<div></div>");
    valueelement.text("Value: " + item.value);
    var labelelement = $("<div></div>");
    labelelement.text("Label: " + item.label);
    $("#selectionlog").children().remove();
    $("#selectionlog").append(labelelement);
    $("#selectionlog").append(valueelement);
    }
    }
    });

    Peter Stoev
    Keymaster

    Hi,

    Small syntax error in the provided code – the ‘,’ after { name: ‘FieldId’, type: ‘string’ } should be removed. In addition, I would request for a more complete sample with the JSON data that will illustrate your scenario.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/


    kevin_wkw
    Participant

    Thanks. I removed ‘,’ and replaced it with ‘int’. However, I still have the same error. The JSON data is below.

    var source =
    {
    datatype: 'json',
    datafields: [
    { name: 'Field', type: 'string' },
    { name: 'FieldId', type: 'int' }
    ],
    url: '/Fields/FetchItems/'
    };
    var dataAdapter = new $.jqx.dataAdapter(source);
    // Create a jqxInput
    $("#input_field").jqxInput({ source: dataAdapter, placeHolder: "Enter:", displayMember: "Field", valueMember: "FieldId", theme: theme });
    $("#input_field").on('select', function (event) {
    if (event.args) {
    var item = event.args.item;
    if (item) {
    var valueelement = $("<div></div>");
    valueelement.text("Value: " + item.value);
    var labelelement = $("<div></div>");
    labelelement.text("Label: " + item.label);
    $("#selectionlog").children().remove();
    $("#selectionlog").append(labelelement);
    $("#selectionlog").append(valueelement);
    }
    }
    });

    Json Test Data :
    [{“FieldId”:0,”Field”:”Action Field 0″},{“FieldId”:1,”Field”:”Action Field 1″},{“FieldId”:2,”Field”:”Action Field 2″},{“FieldId”:3,”Field”:”Action Field 3″},{“FieldId”:4,”Field”:”Action Field 4″},{“FieldId”:5,”Field”:”Action Field 5″},{“FieldId”:6,”Field”:”Action Field 6″},{“FieldId”:7,”Field”:”Action Field 7″},{“FieldId”:8,”Field”:”Action Field 8″},{“FieldId”:9,”Field”:”Action Field 9″}]


    Peter Stoev
    Keymaster

    Hi,

    I tried to reproduce that behavior without avail. Which version of jQWidgets do you use?

    Here’s my code:

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
    <script type="text/javascript" src="../../scripts/jquery-1.10.1.min.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqx-all.js"></script>
    <script type="text/javascript">
    $(document).ready(function () {
    var theme = "";
    var source =
    {
    datatype: 'json',
    datafields: [
    { name: 'Field', type: 'string' },
    { name: 'FieldId', type: 'int' }
    ],
    url: 'test.txt'
    };
    var dataAdapter = new $.jqx.dataAdapter(source);
    // Create a jqxInput
    $("#input_field").jqxInput({ source: dataAdapter, placeHolder: "Enter:", displayMember: "Field", valueMember: "FieldId", theme: theme });
    $("#input_field").on('select', function (event) {
    if (event.args) {
    var item = event.args.item;
    if (item) {
    var valueelement = $("<div></div>");
    valueelement.text("Value: " + item.value);
    var labelelement = $("<div></div>");
    labelelement.text("Label: " + item.label);
    $("#selectionlog").children().remove();
    $("#selectionlog").append(labelelement);
    $("#selectionlog").append(valueelement);
    }
    }
    });
    dataAdapter.dataBind();
    });
    </script>
    </head>
    <body class='default'>
    <input id="input_field" />
    </body>
    </html>

    test.txt is:

    [{"FieldId":0,"Field":"Action Field 0"},{"FieldId":1,"Field":"Action Field 1"},{"FieldId":2,"Field":"Action Field 2"},{"FieldId":3,"Field":"Action Field 3"},{"FieldId":4,"Field":"Action Field 4"},{"FieldId":5,"Field":"Action Field 5"},{"FieldId":6,"Field":"Action Field 6"},{"FieldId":7,"Field":"Action Field 7"},{"FieldId":8,"Field":"Action Field 8"},{"FieldId":9,"Field":"Action Field 9"}]

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    kevin_wkw
    Participant

    Thanks Peter. It was my mistake. I am good now.


    Gab
    Member

    Hello Kevin,

    Will you Please post the cause for the issue, i’m getting this problem when i tried to use jqxcombobox in jqxgrid and unable to solve this.

    Thanks in advance.

    Regards,
    Gabriel

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.