简体   繁体   English

选择下拉列表,然后更改单选按钮的值

[英]Dropdown selected follow by change value of radio button

I am using Kendo here.我在这里使用剑道。 I have dropdown (itemType)consists of 3 category: *default value = inventory我的下拉列表(itemType)由 3 个类别组成:*默认值 = 库存

  • inventory存货
  • asset资产
  • P&L损益

and also radio button (purchase status) consists of 2 type which is: *default value= NP并且单选按钮(购买状态)由两种类型组成:*默认值= NP

  • NP NP
  • ML机器学习

So that, I have 2 condition here:所以,我在这里有两个条件:

if (itemType == "Asset" || itemType == "Inventory"){
    //radio button will be NP
}
    else if  (itemType == "P&L"){
    //radio button will be ML
}

JavaScript JavaScript

fields: {   
    itemType: {editable: true, defaultValue: "inventory", validation: {required: true} },
    purchaseStatus: {editable: true, defaultValue: "NP", validation: {required: true} },

columns: [ 
    { field: "itemType", title:"Item Type"}, 
    { field: "purchaseStatus", title:"Purchase Status"},
],

HTML HTML

//Dropdown
 <!-- ITEM TYPE --> 
    <div class="k-edit-label">
        <label for="itemType">Item Type</label>
    </div>
    <select id="itemType" name="itemType" style="width:60%; margin:5px 0px 5px 0px;" data-role="dropdownlist" data-bind="value: value"
      <option value="" selected="selected">Choose an option</option>
      <option value="inventory">Inventory</option>
      <option value="asset">Asset</option>
      <option value="P&L">P&L</option>
    </select>

//Radio button
<!-- PURCHASE STATUS -->    
    <div class="k-edit-label">
        <label for="purchaseStatus">Purchase Method</label>
    </div>
    <input class="k-radio" type="radio" name="purchaseStatus" id="NP" value="NP" /> 
    <label class="k-radio-label" style="margin:8px 0px 5px 0px; padding-right:10px;" for="NP" >NP</label>
    <input class="k-radio" type="radio" name="purchaseStatus" id="ML" value="ML" /> 
    <label class="k-radio-label" style="margin:8px 0px 5px 0px;" for="ML" >ML</label>      

But, right now I have tried not working well.但是,现在我试过不能很好地工作。 Anyone can show if I missing something here?任何人都可以显示我是否在这里遗漏了什么? Thank you!谢谢!

<select id="x" onchange="myfun()">
    <option value="inventry">inventry</option>
    <option value="p&l">P&l</option>
    <option value='assets'>Assets</option> </select><lable id="select"></lable><input type="radio" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM