- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can CMS_INPUT_TEXTAREA parse CMS_REF values?
I have a CMS_INPUT_TEXTAREA where custom scripts can be entered, and I want to use CMS_REF(media:"file"), for a JS file I have in the media store, but it doesn't seem to be able to parse, it keeps showing in the html as the literal CMS_REF. Is there a way to parse that or another technique I can use?
- Labels:
-
Developers
- Tags:
- cms_input_textarea
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I don't think this is possible. But probably you could alter your form for this use case a little bit. You could give the editor the option to enter script code in the CMS_TEXT_AREA and to select script files from the media store that should be included using a FS_REFERENCE. That way you wouldn't have to parse the text in the text area.
Hope that helps.
Regards
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am not sure if I understand your scenario.
You first describe the custom scripts before you mention your JS file. Do they have any context to each other?
Could you show us the part of your code where you use the CMS_REF to link the JS file?
Best regardsMichaela
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Michaela, thanks for the reply. I have a page template that has input for custom scripts:
When we're building the pages to add a custom script on the page if needed. The type for this is CMS_INPUT_TEXTAREA.
I was wondering if there was a way to do this in that field:
<script type="text/javascript" src="$CMS_REF(media:"script")$"></script>
Right now, it seems that the CMS_REF won't parse, it shows up as the literal string $CMS_REF(media:"script")$, and I need to move it (for now) to the output channel in the HTML, which is not ideal because then all pages created with this template with include the script, where I only want it include where it's added in custom page scripts. Is there something I can do to get that work, or another technique?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I don't think this is possible. But probably you could alter your form for this use case a little bit. You could give the editor the option to enter script code in the CMS_TEXT_AREA and to select script files from the media store that should be included using a FS_REFERENCE. That way you wouldn't have to parse the text in the text area.
Hope that helps.
Regards
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the reply. Good idea, that solves my problem and is simple.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Why not use "stTextArea.parse" ??? Then all text in the area will be parsed. I think that is what you want.

