Replace Dynamic Text Data With Another Value


#1

Okay, I’ve been trying to workaround an issue here. I’ve got so far and I may not be heading in the right direction so if there’s a better way to approach this then let me know.

I’m using Dynamic Text Replacement to pull form dropdown data onto the form confirmation dialogue which I want to use as my form destination. I’ve got the confirmation dialog to successfully display form information.

What I’d like to do next is replace the dynamic text with something different based on which answer from the form has been placed there (answers are limited to 5 specific selections from a dropdown).

Basically, when someone selects product A from the dropdown in the form they would be shown a price for product A in the confirmation dialog popup (instead of being shown ‘Product A’).

I’ve come across some text replacement javascript that I’ve used and tested successfully on the page.

> <h3 id="title"class="lato dark bold title">certain text</h3>
> <span class="orange size22"><b id="subtitle" >this text</b></span>

<script>
  if (document.getElementById('title').innerHTML == "certain text" ) {
     document.getElementById('subtitle').innerHTML = 'new text';
  }
</script>

My hope was to add an ID to ub:clientsidedynamic for it to find at least one of my dropdown options such as ‘Product A’ and replace it with my desired price.

I changed the original dynamic text source code with:

<ub:clientsidedynamic class="text-editor-dynamic-tag" id="title" contenteditable="true" method="" parameter="window_type" title="URL Parameter: window_type" wrap="true">PRICE</ub:clientsidedynamic>

adding the ID of ‘title’ in a hope that it would work with my above Javascript.

Does anybody have any idea as to why this doesn’t work? Or if I’m even heading in a plausible direction with this.

Many thanks.