Bug #45071
Fluid tries to parse inside an in-HTML Javascript code
Status: | Closed | Start date: | 2013-02-01 | |
---|---|---|---|---|
Priority: | Won't have this time | Due date: | ||
Assigned To: | - | % Done: | 0% |
|
Category: | View | |||
Target version: | TYPO3 Flow Base Distribution - 1.1.1 | |||
Has patch: | No | Affected Flow version: | FLOW3 1.1.0 |
Description
Example. When I try this:
<script type="text/javascript"> $(function(){ var id = '#{id}'; $(id).datepicker({ dateFormat: "dd/mm/yy", changeMonth: true, changeYear: true }); }); </script>
I got this HTML as result:
<script type="text/javascript"> $(function(){ var id = '#dummy-id-01'; $(id).datepicker(Array); </script>
To overcome this issue, we inserted a dummy comment. :)
<script type="text/javascript"> $(function(){ var id = '#{id}'; $(id).datepicker({ dateFormat: "dd/mm/yy", // DO NOT EVER REMOVE THIS COMMENT! changeMonth: true, changeYear: true }); }); </script>
So, The HTML results is as expected:
<script type="text/javascript"> $(function(){ var id = '#dummy-id-01'; $(id).datepicker({ dateFormat: "dd/mm/yy", // DO NOT EVER REMOVE THIS COMMENT! changeMonth: true, changeYear: true }); </script>
Related issues
History
#1 Updated by Thiago Colares over 2 years ago
NOTE: the FLUID parse a Javascript array, but it should not!!
#2 Updated by Adrian Föder over 2 years ago
- Status changed from New to Closed
- Priority changed from Should have to Won't have this time
Thiago, this is as per-design and is "fixed" in version 2.0.
Meanwhile, wrap your JavaScript code in CDATA blocks, like
1<script type="text/javascript">
2<![CDATA[
3 $(function(){
4 var id = '#]]>{id}<![CDATA[';
5 $(id).datepicker({
6 dateFormat: "dd/mm/yy",
7 changeMonth: true,
8 changeYear: true
9 });
10
11 });
12]]></script>
Untested.
Feel free to reopen if necessary.
#3 Updated by Thiago Colares over 2 years ago
Ok! Thanks for clarify me!
Adrian Föder wrote:
Thiago, this is as per-design and is "fixed" in version 2.0.
Meanwhile, wrap your JavaScript code in CDATA blocks, like[...]
Untested.
Feel free to reopen if necessary.
#4 Updated by Karsten Dambekalns almost 2 years ago
- Target version changed from 2052 to 1.1.1