How to default loop & merge values based on previous values? | XM Community
Skip to main content

Apologies if this has been asked, I tried finding the answer.

I’m trying to create a multi-year budget form. The intent is that the user would fill out values for YR1, then when they continue to YR2, the default values for YR2 would be whatever had been entered in YR1. 

I have a Loop & Merge block for my budget that is based off of a numeric value. I ask the user how many budget periods they have, they provide a numeric value and that is the number of times my Budget question will loop. 

My Budget Question is a Side-by-Side question with a dropdown value to select the Cost Type, then text fields to enter a description and cost for each type. Example is below:

 

My intent is that after entering the all the values for the first year/loop, when the user moves forward to the next year/loop, the values in all 3 columns (pictured above) would copy over as the default value for that loop. Same copy functionality would apply for each new loop.

Any help is appreciated. I’m happy to explore any approach. Thank you! 

You can write JS to save all the values to embedded data fields in an addOnPageSubmit() function.

For the your text entry SBS fields, make the default choices the embedded data fields.

For you dropdowns, you’ll need to pipe the embedded data fields into some JS and use them to set the dropdown values in an addOnload() function.


Thanks Tom! These seems like some JS that I might actually be able to accomplish.


Leave a Reply