Add a Constant Sum Row to a Side by Side Question | XM Community
Skip to main content
I am looking to add a row that will calculate the running total and have a mandatory value for each column in a side by side table. Ideally, I would like each column to be able to have a different mandatory sum. Does anyone have code that could help with this? Thanks in advance.
Yeah! What you do is the following:



How familiar are you with Javascript? If you're familiar, I can tell you in English - if not, let me know and I can code it out for you!



But select the field's ID, and put a JQuery `.change()` listener on the fields you want to total. When any of the fields changes, create and call a function that sums the values, and then use JQuery's `.val()` to set the value to the validation total.



A tip on ways to make it more fluid of a UX is to put a `setTimeout()` on the assigning of the sum so that the user has time to correct and then see the change reflected in the sum. I typically set mine to 300 Milliseconds.
Thank you! This is excellent.
@mpf2018 I'm glad it worked! Again, let me know if you need any elaboration.
Hi @Michael_Campbell_RedPepper. Sorry for reviving the question but I'd like to do this as well and am not as well-versed with Javascript. If I could get some elaboration on that I'd be very appreciative. Thanks!
@Michael_Campbell_RedPepper

Thank you. I'm also trying to do this, and don't have much familiarity with JavaScript. Could you please elaborate or script it out? Thank you!
Here's my side-by-side. I was able to remove the selections in the last row except for the last one under "Hours Claimed", and now want to have the last row/column entry calculate a sum of all the hours entered. Thanks!



!
Me too, I would like to do the same.
I also would like to do a side by side question with a constant sum. I don't know how to program Javascript. Can you help? Many thanks!!

Hello, I also would like to know how to program a constam sum in a side by side. :)


Leave a Reply