passing vars to javascript in attribute type controller

Permalink
Along the lines of
http://www.concrete5.org/documentation/how-tos/developers/javascrip...

Which is fine for single pages and blocks, I'm looking to pass variables to the form.php file from a custom select attribute type controller's form() method to a script. Problem is script elements seem to get stripped from form.php's resulting html.

Looking at the core files isn't much help.
concrete/core/models/attribute/types/select.php
concrete/core/models/attribute/types/select/form.php

The core form.php just renders script tags at will, but seems this is not allowed for my attribute controller's form.php, I'm assuming this is maybe a security issue.

Can someone tell me if this supposed to work or not and what's the proper method in this case?

Workaround: Since my controller's form.php can output simple els like span,p, h1 etc, I output something like:
<span class="sel hide"><?php echo $value ?></span>


for now the js can get the text from the hidden span, works but clunky.