Forums

Events on Fields and Buttons in Repeater Area

itpates 05 Apr, 2018
For progressively added fields, the Events "Add to" works okay. I would prefer if we had the option to force it to 2 decimal places so we'd have 5.00 instead of just 5, or 5.50 instead of just 5.5.

BUT, removing a field buggers this up. Not only is the value of the removed field not removed from the total, if I add in another field, the math continues to work off the old total, and sometimes slaps on a bunch of decimal places.

Also, even though I have it set to On Change, I have to click into another field before the number shows up in the target field.

healyhatman 05 Apr, 2018
https://www.w3schools.com/jsref/event_onchange.asp

That's how onchange works.

If you want the thing to happen immediately, you will need to make your own oninput function
GreyHead 06 Apr, 2018
Hi ipates,

Please see the Working with JavaScript section in this FAQ for some code I devised to work in CFv5. It watches the Add Button and runs a function after a short delay (to allow the new row to be added).

When I used that I built and maintained a JS variable with an array of the current Repeater row ids to take account of Adds and Removes; then used that array to do calculations across the current rows.

Bob
This topic is locked and no more replies can be posted.