Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Send values to javascript within a template control block


2 Posts   568 Views


2 December 2011 at 12:05pm (Last edited: 2 December 2011 12:06pm), Community Member, 8 Posts

Hi, I am trying dynamically push values from a Page Control into some inline JavaScript in a .ss Template as such:

<% control MyControl %>
<% end_control %>

The JavaScript that gets outputted to HTML is:


That is, all values come out blank. I know this control has data because if I remove the script tags within the control block the values appear in the HTML fine.

Is what I am trying to do possible?? If so, what am I doing wrong?


3 December 2011 at 2:31pm Community Member, 395 Posts

So do you mean if you take off the script tags then the value gets printed, if so a work around solution will be to add those scrip tags out of the <% control %> block.

Out of question don't you need quotes around the argument you pass to the js push method?