Code snippet for getting values out of a rg

Hey recently I replaced the orchestra plugin with a a JavaScript to bubble element and a few lines of code.

I’d like to do similar for the RG tools by BDK or the inputValues plugin where as you can extract values from a repeating group to an element that sits outside a repeating group.

Anyone have some code or a method to do similar without a plugin?

Just give the element(s) you need to extract values from a unique ID attribute (based on the cell index) - then just use a Run JavaScript action to extract the value for that particular element, and pass it to a JavaScriptToBubble element.

What is the code I would use to do such a thing?

Just a basic element rerteival:

document.getElementById('myElement');

Then, it depends on the type of element as to how to ‘read’ its value, but assuming it’s an Input, you can use the ‘value’ property.

So just use something like this:

let targetElement = document.getElementById('myInput');
let extractedValue = targetElement.value;
bubble_fn_myBubbleFunction(extractedValue);

Here’s a simple example:

What about to get the whole list and store it as a parameter or state?

Would I iterate over each one using js?

Yeah, just get all the elements by class (or iterate over the RG items and retrieve each element by ID), and ‘push’ each value to an array, which you can then pass to a JavaScript to Bubble element.

1 Like

Look at the bubble helper toolkit. I already made it a public free plugin :rofl:

Was like the first thing I learned how to replicate my tearing apart the code.

What is this helper tool kit you speak of?

Is it code I can pull apart or a plugin that has all of these functions?

Forkable plugin with exactly what I’m looking for

You’re a gem @jared.gibb

1 Like