简体   繁体   中英

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

  • inventory
  • asset
  • P&L

and also radio button (purchase status) consists of 2 type which is: *default value= 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

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

//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" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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