Note that there are some explanatory texts on larger screens.

plurals
  1. POHorizontal and Vertical complicated Javascript Calculation and Coldfusion
    primarykey
    data
    text
    <p>Now the table is being populated with 2 loops and an array. I have to control everything through the classes I put on the input. Been working on this for a while, some insight would be helpful. </p> <p>Here is the loop and the inputs: </p> <pre><code> &lt;cfloop from="1" to="#ArrayLen(labels)#" index="r"&gt; &lt;tr&gt; &lt;td class="labels"&gt;&lt;cfif ArrayIsDefined(labels,r) AND labels[r] NEQ "Open"&gt;#labels[r]#&lt;/cfif&gt;&lt;/td&gt; &lt;cfloop from="1" to="7" index="i"&gt; &lt;td id="Day#i#" class="row#r# col#i#"&gt; &lt;cfif r EQ 1&gt;#Left(DayOfWeekAsString(i),3)#&lt;cfelse&gt;&lt;cfif r EQ 2&gt;&lt;input type="text" class="date-mask" /&gt;&lt;cfelse&gt;&lt;input type="text" class="R#r# C#i#" onkeypress="return HorizVertiCalc(#r#, #i#)" /&gt;&lt;/cfif&gt;&lt;cfif r EQ 25&gt;&lt;input type="text" class="dailyTot#r#" onkeypress="return VertiCalc(#i#)" /&gt;&lt;/cfif&gt;&lt;/cfif&gt;&lt;/td&gt; &lt;/cfloop&gt; &lt;td class="totals"&gt;&lt;cfif r EQ 1&gt;Total&lt;cfelse&gt;&lt;input type="text" class="ttl#r# vttl#i#" readonly="readonly" /&gt;&lt;/cfif&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/cfloop&gt; </code></pre> <p>And here is the Javascript I've got at the moment:</p> <pre><code> HorizVertiCalc = function(h, v){ $('.R'+h).sum("keyup", ".ttl"+h); $('.C'+v).sum("kepup", ".dailyTot"+h); if($('.R'+h) == $('.R4')){ Number($(this).val()) * &lt;cfoutput&gt;#mileage#&lt;/cfoutput&gt;; $(this).sum("keypup", ".R5"); } } VertiCalc = function(v){ alert($('.C'+v)); } </code></pre> <p>I need to be able to get the daily totals and the grand total and the totals each category (which I'm able to do right now.). Also, I need to be able to multiply the milage # by the number specific with the variable #mileage# and have the total for that cell be directly below it. </p> <p>Well. It's a lot and if anyone can give some help, it would be greatly appreciated!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload