Nothing is selected DropDownList but value is not blank

5 posts, 0 answers
  1. Patrick Rioux
    Patrick Rioux avatar
    53 posts
    Member since:
    Sep 2012

    Posted 20 Feb 2012 Link to this post

    Hi,

    I have a DropDownList using a server-side paging and when I have nothing selected, the control still return a value.

    .text() return blank (ok)
    .value() return something even if I didn't select anything yet.  Very strange default behavior.
    Any idea?

    <script type="text/javascript">

    function logSelected() {
    var dropdownlist $("#dropDownList").data("kendoDropDownList");
    var txt dropdownlist.text();
    var val dropdownlist.value();
         kendoConsole.log('[Selected Value:'+val+']'+' [Text:'+txt+']');
          }
        
        $(document).ready(function() {
        
     $("#dropDownList").kendoDropDownList({
                autoBind: false,
                dataTextField: "SalesrepName",
                dataValueField: "SalesrepId",
                change: function(){
        },
       filter: "contains",
      minLength: 1,
      template: $("#scriptTemplate").html(),
      columns: [{field:"SalesrepId",title:"Salesrep"},
                          {field:"SalesrepName",title:"Salesrep Name"}],
                dataSource: new kendo.data.DataSource({
                    type: "odata",
                    serverFiltering: true,
                    serverPaging: true,
                    pageSize: 20,
                    transport: {
                        read: "csp/mediapool/public/dt.common.odata.RequestServer.cls?$select=SalesrepId,SalesrepName&$tablename=dt_common_ui_samples_data.Salesrep&$orderby=SalesrepName"
                    }
                })
            });
    });
    </script>
  2. Patrick Rioux
    Patrick Rioux avatar
    53 posts
    Member since:
    Sep 2012

    Posted 20 Feb 2012 Link to this post

    Just find out that setting the value manually fix the issue but I think this is a bug.

    <input id="dropDownList" style="width:300px" value=""/>
  3. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3747 posts

    Posted 21 Feb 2012 Link to this post

    Hello Patrick,

     
    I could not replicate the described issue. Check this jsFiddle demo and let me know if I am missing something.

    Greetings,
    Georgi Krustev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  4. Brian
    Brian avatar
    4 posts
    Member since:
    Jan 2012

    Posted 22 Feb 2012 Link to this post

    I have the same issue. The DropDownList won't submit an empty value. This seems to be a common use to have an option label which has an empty value. Is there a way to make this work properly?

    Please check out the following fiddle which illustrates the issue:
    http://jsfiddle.net/pL4JA/1/

    When "Select a value" is selected and you click the button -- the value of the dropdown should be empty not "Select a value".
  5. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3747 posts

    Posted 23 Feb 2012 Link to this post

    Hello,

     
    Thank you for drawing our attention to this issue. The fix will be available in the next internal build of Kendo UI. For those who cannot download latest internal build, the fix will be available in the next official release of Kendo UI.

    Kind regards,
    Georgi Krustev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top