今回はfor ループ内のif 条件からの配列値を入力フィールドに入れようとしています。ここで変数v (ここで -: alert(v);) の値は次のようになります
(1.00,1.00,1.00,1.00,1.00,1.00,2.00,3.00,1.00,1.00) で、for ループの外側の値は (0,0,0,0,0,0,0,0,0,0) です。ここまでは順調ですが、
ここで、この値 (0,0,0,0,0,0,0,0,0,0) を変数 v の代わりに (1.00,1.00,1.00,1.00,1.00,1.00,2.00,3.00) に入れたい,1.00,1.00)。
コードedit.js :
getAccountName : function(container){
return jQuery('input[name="projecttaskhours"]',container).val();
},
getDuration : function(container){
var a = [];
a.push(jQuery('input[name="cf_977"]',container).val());
a.push(jQuery('input[name="cf_979"]',container).val());
a.push(jQuery('input[name="cf_981"]',container).val());
a.push(jQuery('input[name="cf_983"]',container).val());
a.push(jQuery('input[name="cf_985"]',container).val());
a.push(jQuery('input[name="cf_997"]',container).val());
a.push(jQuery('input[name="cf_999"]',container).val());
a.push(jQuery('input[name="cf_1001"]',container).val());
a.push(jQuery('input[name="cf_1003"]',container).val());
a.push(jQuery('input[name="cf_1005"]',container).val());
return a;
},
checktaskhour : function(form){ //alert("dsfd");
var thisInstance = this;
var v = thisInstance.getDuration(form); alert(v);
var choose = jQuery('select[name="assigned_user_id"]').prop('selected',true).trigger('chosen:updated').val(); // alert(choose).val();
var accountName = thisInstance.getAccountName(form);
if(choose==true){
var multiplier = 0;
for (i = 0; i < v.length; i++) {
v[i] *= multiplier;
} // alert(v);
}
},
以上です。私の主張が理解できたら、私を導いてください.....ありがとう!!