0

正常に動作するテスト HTML ページにコードがあります。ページを作成するときに、QuickBase フォームのフィールドをグループ化する NxN 多次元配列を作成します。window.flds 配列に値を設定するコードは次のとおりです。

<script type="text/javascript">
    var flds = [];
    function pushFields(groupIdx,srcVal){
        var iGroupIdx = groupIdx+1;
        if(iGroupIdx > window.flds.length){
            var fldsfloor = window.flds.length;
            for(var i = fldsfloor; i < iGroupIdx; i++){
                if(!window.flds[i]){
                    window.flds[i] = [];
                }
            }
        }
        var j = window.flds[groupIdx].length;
        window.flds[groupIdx][ j ] = srcVal;
    }
    //dummy code to populate window.flds manually:
    pushFields(17,101);
    pushFields(17,104);
    pushFields(5,102);
    pushFields(28,103);
    pushFields(28,105);
</script>

これを QuickBase テンプレートに押し込もうとしても、うまくいきません。QuickBase は jQuery を使用してフィールドを構築します。jQuery から JavaScript 関数 pushFields(x,y) を呼び出す方法:

function loadProcess(root, rid) {
    //... code doesn't get relevant until here:
    if(groupx == 5){
        var processRes = getResults("abcde1fgh", "{3.EX." + rid + "}", "3.102", "60");//the value of 3 would be 5 for the first parameter, and 102 would be the second parameter.
        var ctrl1 = "<br /> Date" + addControl(v[3], "Date", "", v[102], "", " ");
    }
    //... code doesn't get relevant again until here:
    if(groupx == 17){
        var processRes = getResults("abcde1fgh", "{3.EX." + rid + "}", "3.101.104", "60");//the value of 3 would be 17 for the first parameter, and 101 and 104 would be the second parameter.
        var ctrl2 = "<br /> FName" + addControl(v[3], "Text", "", v[101], "", " ");
        var ctrl3 = "<br /> LName" + addControl(v[3], "Text", "", v[104], "", " ");
    }
    //... code doesn't get relevant again until here:
    if(group3 == 28){
        var processRes = getResults("abcde1fgh", "{3.EX." + rid + "}", "3.103.105", "60");//the value of 3 would be 28 for the first parameter, and 103 and 105 would be the second parameter.
        var ctrl4 = "<br /> Email" + addControl(v[3], "Text", "", v[103], "", " ");
        var ctrl5 = "<br /> Phone" + addControl(v[3], "Text", "", v[105], "", " ");
    }
}
4

1 に答える 1

0

ありがとう、みんな、私は解決策を見つけることができました:

                pushFields(102,v[3]);
于 2013-07-31T10:21:10.180 に答える