This is a migrated thread and some comments may be shown as answers.

attr help

1 Answer 63 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Troy Clemons
Top achievements
Rank 1
Troy Clemons asked on 30 Mar 2012, 12:33 AM
i am trying to disable a drop down list control

here is the code

$("#payment").attr('disabled', 'disabled');

this does not seem to happen at all

here is the payment control

<label for="payments">Payment Type:&nbsp;&nbsp;&nbsp;</label><input id="payment" data-bind="value: payment" name="payment" />

and the code load the datasource
$.ajax({
                                url: 'dsr.asmx/get_Payment',
                                async: true,
                                cache: false,
                                timeout: 30000,
                                contentType: 'application/json; charset=utf-8',
                                data: "{}",
                                type: 'POST',
                                dataType: 'json',
                                success: function (msg) {
                                    $("#payment").val("revpay").kendoDropDownList({
                                        index: 0,
                                        optionLabel: "Select Payment Type",
                                        dataTextField: "Description",
                                        dataValueField: "Code",
                                        filter: "contains",
                                        suggest: true,
                                        minLenght: 1,
                                        change: onPayChange,
                                        dataSource: {
                                            data: msg.d
 
                                        }
                                    });
                                }
                            });

and the function to disable the control by another drop down list choice
function onResChange() {
               var res = document.getElementById("result").value;
               switch (res) {
                   case 'c':
                       alert('Canceled');
                       $("#payment").attr('disabled', 'disabled');
                       break;
                   case 'cb':
                       alert('Call Back no Sale');
                       break;
               }
           }

the alert's work but the .attr is never firing

1 Answer, 1 is accepted

Sort by
0
Troy Clemons
Top achievements
Rank 1
answered on 30 Mar 2012, 12:42 AM
i found it under the documentation for the drop down list under configuration

Drop Down List Configuration

here is the answer

var dropdownlist = $("#dropdownlist").data("kendoDropDownList");
// disable the dropdown
dropdownlist.enable(false);
Tags
General Discussions
Asked by
Troy Clemons
Top achievements
Rank 1
Answers by
Troy Clemons
Top achievements
Rank 1
Share this question
or