You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@click.apache.org by Sven Pfeiffer <sv...@madsep.de> on 2009/03/21 16:46:05 UTC
Problem with getHtmlImports
Hi List,
I'm quite new to click and tried to create a Custom-Field, quite similar
to the CalendarField, which needs javascripts and style-sheets.
So I've overriden the getHtmlImports() method to return my script and
CSS and the result was quite odd.
The CSS (<link ...> is added to the <head>-Section as expected, but the
<script ..> is missing.
This is what I returned as Imports:
"<link type=\"text/css\" rel=\"stylesheet\"
href=\"/webui/styles/myField.css\"/>\n"
+ "<script type=\"text/javascript\"
src=\"/webui/click/myField.js\"></script>\n"
(/webui is the context-path of my webapp)
Then I tried the same with the CalendarField (from Click Extensions) and
got the same problem, CSS is used, but the scripts are missing.
CalendarField uses the following as HtmlImports:
"<link type=\"text/css\" rel=\"stylesheet\"
href=\"{0}/click/calendar/calendar-{1}{7}.css\"/>\n"
+ "<script type=\"text/javascript\"
src=\"{0}/click/control{7}.js\"></script>\n"
+ "<script type=\"text/javascript\"
src=\"{0}/click/calendar/calendar{7}.js\"></script>\n"
+ "<script type=\"text/javascript\"
src=\"{0}/click/calendar/calendar-{2}{7}.js\" charset=\"UTF-8\"></script>\n"
+ "<script type=\"text/javascript\">addLoadEvent( function()
'{'Calendar.setup('{' inputField : ''{3}'', ifFormat : ''{4}'',
showsTime : {5}, button : ''{3}-button'', align : ''cr'', singleClick :
true, firstDay : {6} '}');'}');</script>\n";
Any idea what may cause this?
I am using 2.0.1-incubating as maven dependency.
Thanks in advance
SVen
Re: Problem with getHtmlImports
Posted by Sven Pfeiffer <sv...@madsep.de>.
Hi Bob,
yes, that was my mistake.
I just used the $cssImports and changed it to $imports.
Thank you for your fast reply!
SVen
Bob Schellink wrote:
> Hi Sven,
>
> The way you specify imports looks right to me.
>
> It might be that you specify the $cssImports variable but not $jsImports?
>
> In your page template make sure you reference both variables. You can
> also use the variable $imports, which includes both JS and Css.
>
> If this doesn't solve your issue let us know.
>
> kind regards
>
> bob
>
>
> Sven Pfeiffer wrote:
>> Hi List,
>>
>> I'm quite new to click and tried to create a Custom-Field, quite
>> similar to the CalendarField, which needs javascripts and style-sheets.
>>
>> So I've overriden the getHtmlImports() method to return my script and
>> CSS and the result was quite odd.
>>
>> The CSS (<link ...> is added to the <head>-Section as expected, but
>> the <script ..> is missing.
>>
>> This is what I returned as Imports:
>> "<link type=\"text/css\" rel=\"stylesheet\"
>> href=\"/webui/styles/myField.css\"/>\n"
>> + "<script type=\"text/javascript\"
>> src=\"/webui/click/myField.js\"></script>\n"
>>
>> (/webui is the context-path of my webapp)
>>
>> Then I tried the same with the CalendarField (from Click Extensions)
>> and got the same problem, CSS is used, but the scripts are missing.
>>
>> CalendarField uses the following as HtmlImports:
>> "<link type=\"text/css\" rel=\"stylesheet\"
>> href=\"{0}/click/calendar/calendar-{1}{7}.css\"/>\n"
>> + "<script type=\"text/javascript\"
>> src=\"{0}/click/control{7}.js\"></script>\n"
>> + "<script type=\"text/javascript\"
>> src=\"{0}/click/calendar/calendar{7}.js\"></script>\n"
>> + "<script type=\"text/javascript\"
>> src=\"{0}/click/calendar/calendar-{2}{7}.js\"
>> charset=\"UTF-8\"></script>\n"
>> + "<script type=\"text/javascript\">addLoadEvent( function()
>> '{'Calendar.setup('{' inputField : ''{3}'', ifFormat : ''{4}'',
>> showsTime : {5}, button : ''{3}-button'', align : ''cr'', singleClick
>> : true, firstDay : {6} '}');'}');</script>\n";
>>
>>
>> Any idea what may cause this?
>>
>> I am using 2.0.1-incubating as maven dependency.
>>
>> Thanks in advance
>>
>> SVen
>>
>
>
Re: Problem with getHtmlImports
Posted by Bob Schellink <sa...@gmail.com>.
Hi Sven,
The way you specify imports looks right to me.
It might be that you specify the $cssImports variable but not $jsImports?
In your page template make sure you reference both variables. You can
also use the variable $imports, which includes both JS and Css.
If this doesn't solve your issue let us know.
kind regards
bob
Sven Pfeiffer wrote:
> Hi List,
>
> I'm quite new to click and tried to create a Custom-Field, quite similar
> to the CalendarField, which needs javascripts and style-sheets.
>
> So I've overriden the getHtmlImports() method to return my script and
> CSS and the result was quite odd.
>
> The CSS (<link ...> is added to the <head>-Section as expected, but the
> <script ..> is missing.
>
> This is what I returned as Imports:
> "<link type=\"text/css\" rel=\"stylesheet\"
> href=\"/webui/styles/myField.css\"/>\n"
> + "<script type=\"text/javascript\"
> src=\"/webui/click/myField.js\"></script>\n"
>
> (/webui is the context-path of my webapp)
>
> Then I tried the same with the CalendarField (from Click Extensions) and
> got the same problem, CSS is used, but the scripts are missing.
>
> CalendarField uses the following as HtmlImports:
> "<link type=\"text/css\" rel=\"stylesheet\"
> href=\"{0}/click/calendar/calendar-{1}{7}.css\"/>\n"
> + "<script type=\"text/javascript\"
> src=\"{0}/click/control{7}.js\"></script>\n"
> + "<script type=\"text/javascript\"
> src=\"{0}/click/calendar/calendar{7}.js\"></script>\n"
> + "<script type=\"text/javascript\"
> src=\"{0}/click/calendar/calendar-{2}{7}.js\"
> charset=\"UTF-8\"></script>\n"
> + "<script type=\"text/javascript\">addLoadEvent( function()
> '{'Calendar.setup('{' inputField : ''{3}'', ifFormat : ''{4}'',
> showsTime : {5}, button : ''{3}-button'', align : ''cr'', singleClick :
> true, firstDay : {6} '}');'}');</script>\n";
>
>
> Any idea what may cause this?
>
> I am using 2.0.1-incubating as maven dependency.
>
> Thanks in advance
>
> SVen
>