2015-05-14 51 views
-1

我有一個基本的HTML表單,當頁面加載它時,將表單加載到初始值,沒有數據。如何基於另一個下拉選擇項目在下拉列表中設置默認值

在單頁我已經添加了兩個標籤的容器左側網格,右側

是HTML表單

什麼都認爲是在網格中加載的,當我們雙擊它,將填補右邊的形式記錄。

我的要求是基於一種類型的下拉選擇值我怎樣才能得到產品下拉的默認值。

例如:我有一個左側網格類型的數據Fab的列..當我們雙擊這一行時,表格將填充選定的值 Fab。當類型下拉列表中的選定值是fab我需要檢查產品下拉列中的空值或空值並設置默認值。

我們在下拉列表的產品中得到的值是

NULL 
NULL 
SH_TY 
HG_IU 
NULL 
NULL 

我們在下拉列表類型得到的值是

Fab 
LOI 
TYU 
Swa 

這是我們正試圖填補代碼的形式

這裏是列名

var formFields = [ 
{column: 'ProductTypeId'}, 
{column: 'ProductCodeID'},], 

    var fillForm = function (record) { 
       for (var i in formFields) { 
        if (formFields[i].column != null) { 
         var currentValue = record[formFields[i].column]; 
         var initValue = record[formFields[i].column + "_init"]; 
         formFields[i].ref.set('value', (currentValue == null) ? '' : currentValue); 

if (formFields[i].column == 'BtDate') { 
          formFields[i].ref.set('value', (currentValue == null || currentValue == '0') ? '0' : '1'); 
         } 

I tried to check like this but not working 

if (formFields[i].column == 'ProductTypeId') { 
         if(currentValue == "Fab" || currentValue == "Swa") 
          { 
       formFields[i].ref.set.column.ProductCodeID('value', (currentValue == null || currentValue == '' || currentValue == currentValue) ? 'A_CL_FA': currentValue); 
         } 
        } 

回答

0

您需要使用屬性的方式選擇您的下拉列表的值與null的不同。

+0

我didnt瞭解,我的ProductTypeId字段是篩選選擇類型。 –

相關問題