Using a variable from Widget JavaScript tab in HTML tab under <script>

While this pertains to the work I have been trying to do on the Stock Ticker (i.e RSS) Widget, there may be some value to asking this question outside of that topic - so here it is.

The issue I have run into is that I need to pass an encoded url string to the iframe component on the HTML page. I can build this string in the JavaScript tab and then on the HTML tab I have a defined iframe component with an id of “stocks”.

At the end of my HTML code, I have a section that does this:

  • the … hardcoded url … string above was replaced for clarity, its is a fully formed url containing the info to pass to the src for the iframe. The same is true below for the source var.

On the JavaScript tab, I have this code:
var source = “… hardcoded url string …”;
var args = widget.find(’[data-ui-field=stock_2sym]’)
// “symbols:proName:”+data-ui-field=“stock_2sym”+" title:"+data-ui-field=“stock_2desc”;
// var javascriptargs = encodeURI(args);
widget.find(’[data-ui-field=source_value]’).html(source);

What I want to do is build the source var from the individual symbols (1 thru 5) I can define for the widget, and then pass that to this command in the on the HTML tab:

document.getElementById(“stocks”).src=source;

But for the life of me I cannot figure out the correct syntax to reference the source var from the JavaScript tab in the section of the HTML tab.

Hope that makes sense and what I am asking is possible, and it is just a matter of figuring out the correct syntax.

Thanks

Anyone have a suggestion ???

I just posted to you ticker thread
Add a ui field (NAME) to the HTML side then in the java side add
widget.find(’[data-ui-field=NAME ]’).html(variable);

Thanks - I posted a reply on the other thread too. Your suggestion helped with one issue but i ran into another.