Need Help With Array Total Calculation


hello,

 

posted code few days ago getting array working comboboxes.  well, have working issue having need values need totaled in single text box depending if field selected using combobox.  following working code:

 

(function () {

    var invoice = {};

invoice["work hour_1"] = event.value = this.getfield("workcostsclaimed1").value;

invoice["work hour_2"] = event.value = this.getfield("workcostsclaimed2").value;

invoice["work hour_3"] = event.value = this.getfield("workcostsclaimed3").value;

var vala = this.getfield("invoicetype1").value;

var valb = this.getfield("invoicetype2").value;

var valc = this.getfield("invoicetype3").value;

    if (vala in invoice)

        event.value = invoice[vala];

    if (valb in invoice)

        event.value = invoice[valb];

    if (valc in invoice)

        event.value = invoice[valc];

  })();

 

the summaryworkcost1 field field need value totals combined in.  code trying insert, in order calculate total value, this:

 

 

var starter = this.getfield("summaryworkcost1");
starter.editable = true;

var j=0;

var valtotal = invoice[vala,valb,valc];
for(j=0; j<valtotal.length;j++){
starter.insertitemat(valtotal[j],j);
}

 

not sure if correct code use , if where/how insert it.  looking few tips , in advance!



More discussions in JavaScript


adobe

Comments

Popular posts from this blog

Upgrade 3.4.8 to 3.5.1 failed "download package failed" - Joomla! Forum - community, help and support

Joomal 3.6.3 update error - PHP temporary folder is not set - Joomla! Forum - community, help and support

Fatal error during instalation - Joomla! Forum - community, help and support