Skip navigation
Currently Being Moderated

cfajaxproxy bind with dynamic form

Jul 5, 2012 11:44 AM

Tags: #javascript #bind #cfajaxproxy

I have a form with many rows built in a cfloop.  I am trying to do a simple client side calculation if the user changes a value in a text box.  I can ge the calculation to work, but it places the result in the last row of the form rather than the row the user changed.  In other words, they change the values in a text box on row 3 for example.  It calculates the right value(using row 3 values) and places the result in the last row(for example row 54).

 

<td align="center">

     <cfinput id="costPerUnit_#currentrow#" name="costPerUnit_#currentrow#" required="yes" value="#products.COSTPERUNIT#" tabindex="-1">

</td>

 

<td align="center">

     <cfinput id="ozPerUnit_#currentrow#" name="ozPerUnit_#currentrow#" required="yes" value="#products.OZPERUNIT#" tabindex="-1">

</td>

 

<td align="center">

               <cfajaxproxy bind="javascript:doCalcCostPerOz({costPerUnit_#currentrow#},{ozPerUni t_#currentrow#})" />

               <script>

               function doCalcCostPerOz(c,o) {document.getElementById("costPerOz_#currentrow#").value = (parseFloat(c)/parseFloat(o)).toFixed(2);}

               </script>

     <cfinput id="costPerOz_#currentrow#" name="costPerOz_#currentrow#" type="text" value="#products.COSTPEROZ#">

</td>

 

Does anyone have any insight how to make sure the results of the above calculation go to the proper row?  I assume it has something to do with the bind expression above and the fact that the costPerOz_#currentrow# is not in the bind expression.

 
Replies

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points