jQWidgets Forums

jQuery UI Widgets Forums Lists DropDownList DropDownList value problems

This topic contains 4 replies, has 2 voices, and was last updated by  jon.moon 10 years, 7 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • DropDownList value problems #60163

    jon.moon
    Participant

    I just did an upgrade from 3.1.0 to 3.5.0 and all of the scripts that pull values from my drop down lists don’t work. There seem to be 2 different things happening:

    1) The jqxDropDownList widget’s hidden input has no name. Some of the forms that are in my system I am using a jQuery selector to get the form then just running serializeArray() to get an array of all of the inputs of that form. Because the hidden input does not have a name, it doesn’t get into the array or submitted with the rest of the data.

    2) Some of the drop down lists that i use are populated with asynchronous JSON. What is returned is a JSON array with each element having “label” and “val”. I have set the labelMember:”label” and valueMember:”val” but when I run this: $(“#General_3”).val() it returns an empty string, even if I know I have selected something that has a value. I used the Chrome console to dig into it and ran $(“#General_3”).jqxDropDownList(‘getItems’) to look at each item, and each one had its value set to undefined, even though the originalItem has a value in the “val” component. Did something change between 3.1.0 and 3.5.0 that would affect this? I looked through the API documentation and didn’t see anything different.

    Thanks.

    Jon

    DropDownList value problems #60166

    Peter Stoev
    Keymaster

    Hi Jon,

    1. If you did not set the “name” attribute, it would not be set automatically. We have online demos which have Form submit. Note that Id and Name are different attributes which were incorrectly synchronized in previous versions.
    2. There is no property labelMember now or before. I would suggest you to look at the widget samples especially the data binding ones.

    Best Regards,
    Peter Stoev

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

    DropDownList value problems #60169

    jon.moon
    Participant

    Okay, just to clarify, the name attribute has to be on the div that is being turned into the drop down? Or is the name attribute added through the jqxDropDownList constructor?

    As for the other piece, I wrote it incorrectly. I was doing it for memory instead of actually copying from the code. Here’s the exact lines of code that I am using:

    var source_3 = {dataType:"json",datafields:[{name:"label"},{name:"val"}],url:"/search/index/param?id=3",async:true}
    var da_3 = new $.jqx.dataAdapter(source_3);
    $('#advanced_search #A_General_3').jqxDropDownList({selectedIndex:0,placeHolder:'',source:da_3, displayMember:'label',valueMember:'val',width:248,height:25,theme:'ui-redmond'});

    and here’s the first part of the JSON (it’s a long list of state and region names so I don’t want to include it all here):
    [{“label”:””,”val”:””}, {“label”:”Alabama”,”val”:”AL”}, {“label”:”Alaska”,”val”:”AK”}, {“label”:”Alberta”,”val”:”AB”},

    Thanks.

    DropDownList value problems #60188

    Peter Stoev
    Keymaster

    Hi jon.moon,

    “name” is attribute so it should be set in the HTML. The constructor allows you to set properties but these are not attributes.

    Best Regards,
    Peter Stoev

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

    DropDownList value problems #60274

    jon.moon
    Participant

    Thanks for the info on the name attribute, but it still doesn’t fix the other problem I am having. Is there anything in the code that would make it not load the “val” option from the JSON as the value? This exact code worked correctly in 3.1.0 but not in 3.5.0.

    Thanks,
    Jon

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

You must be logged in to reply to this topic.