You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Britske <gb...@gmail.com> on 2008/01/02 11:42:27 UTC

T5: template parser XHTML-well formed --> javascript goes wrong

Hi ,

I have a template which includes a javascript-function: 

function asyncCall (){
  if(($('quickTextField').value.length > 2))
  {
    new Ajax.Request ('${quickSearchBoxLink}',
{asynchronous:true,onSuccess:handleResponse});
  }	
}

However, this gets converted to (note the &gt; instead of '>' (greater than)
:

function asyncCall (){
			alert($('quickTextField').value);
			if(document.getElementById("quickTextField").value.length &gt; 3)
			{
				new Ajax.Request ('/aanbiedingen.quicknavigation:quickSearchBoxAction',
{asynchronous:true,onSuccess:handleResponse});
			}
			
			
		}

Obviously this is because the template outputs well-formed XHTML. 
Still I need to include the function in the template since I need '
${quickSearchBoxLink}' to be translated by Tapestry. How to proceed? 

Thanks,
Geert-Jan
-- 
View this message in context: http://www.nabble.com/T5%3A-template-parser-XHTML-well-formed---%3E-javascript-goes-wrong-tp14576351p14576351.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: template parser XHTML-well formed --> javascript goes wrong

Posted by Fernando Padilla <fe...@alum.mit.edu>.
Another pattern is to push as much javascript into .js files, as 
parameterized functions.  Then from the webpage, you can call the 
appropriate function with the appropriate values.

So you limit the js that you maintain within the template.



Britske wrote:
> Hi ,
> 
> I have a template which includes a javascript-function: 
> 
> function asyncCall (){
>   if(($('quickTextField').value.length > 2))
>   {
>     new Ajax.Request ('${quickSearchBoxLink}',
> {asynchronous:true,onSuccess:handleResponse});
>   }	
> }
> 
> However, this gets converted to (note the &gt; instead of '>' (greater than)
> :
> 
> function asyncCall (){
> 			alert($('quickTextField').value);
> 			if(document.getElementById("quickTextField").value.length &gt; 3)
> 			{
> 				new Ajax.Request ('/aanbiedingen.quicknavigation:quickSearchBoxAction',
> {asynchronous:true,onSuccess:handleResponse});
> 			}
> 			
> 			
> 		}
> 
> Obviously this is because the template outputs well-formed XHTML. 
> Still I need to include the function in the template since I need '
> ${quickSearchBoxLink}' to be translated by Tapestry. How to proceed? 
> 
> Thanks,
> Geert-Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: template parser XHTML-well formed --> javascript goes wrong

Posted by Chris Lewis <ch...@bellsouth.net>.
Hello,

This is a documented issue 
(https://issues.apache.org/jira/browse/TAPESTRY-1818) that has been 
fixed in 5.0.8 (subversion). The bug wasn't that such code was converted 
as T5, for better or worse, attempts to force xml formatted data. Rather 
the bug was that T5 didn't support CDATA blocks - this has been 
addressed in svn.

chris

Britske wrote:
> Hi ,
>
> I have a template which includes a javascript-function: 
>
> function asyncCall (){
>   if(($('quickTextField').value.length > 2))
>   {
>     new Ajax.Request ('${quickSearchBoxLink}',
> {asynchronous:true,onSuccess:handleResponse});
>   }	
> }
>
> However, this gets converted to (note the &gt; instead of '>' (greater than)
> :
>
> function asyncCall (){
> 			alert($('quickTextField').value);
> 			if(document.getElementById("quickTextField").value.length &gt; 3)
> 			{
> 				new Ajax.Request ('/aanbiedingen.quicknavigation:quickSearchBoxAction',
> {asynchronous:true,onSuccess:handleResponse});
> 			}
> 			
> 			
> 		}
>
> Obviously this is because the template outputs well-formed XHTML. 
> Still I need to include the function in the template since I need '
> ${quickSearchBoxLink}' to be translated by Tapestry. How to proceed? 
>
> Thanks,
> Geert-Jan
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: template parser XHTML-well formed --> javascript goes wrong

Posted by yuan gogo <go...@gmail.com>.
<!--
   your javascript code here!
-->

does this help?


2008/1/2, Britske <gb...@gmail.com>:
>
>
> Hi ,
>
> I have a template which includes a javascript-function:
>
> function asyncCall (){
>   if(($('quickTextField').value.length > 2))
>   {
>     new Ajax.Request ('${quickSearchBoxLink}',
> {asynchronous:true,onSuccess:handleResponse});
>   }
> }
>
> However, this gets converted to (note the &gt; instead of '>' (greater
> than)
> :
>
> function asyncCall (){
>                         alert($('quickTextField').value);
>                         if(document.getElementById("quickTextField").value.length
> &gt; 3)
>                         {
>                                 new Ajax.Request('/aanbiedingen.quicknavigation:quickSearchBoxAction',
> {asynchronous:true,onSuccess:handleResponse});
>                         }
>
>
>                 }
>
> Obviously this is because the template outputs well-formed XHTML.
> Still I need to include the function in the template since I need '
> ${quickSearchBoxLink}' to be translated by Tapestry. How to proceed?
>
> Thanks,
> Geert-Jan
> --
> View this message in context:
> http://www.nabble.com/T5%3A-template-parser-XHTML-well-formed---%3E-javascript-goes-wrong-tp14576351p14576351.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>