You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Gustavo Straube Pereira <gu...@nobla.com.br> on 2006/12/08 20:24:07 UTC

Problem with $link.setAction and Javascript

Hi!

I want to parse a link to an action with some javascript variable, like 
this:

  var id = 1;
  window.location = 
'$link.setAction("wishlist").addQueryData("id","'+id+'")';


I've expected this:

  '/content/wishlist.do?id='+id+''

But my output looks like this:

  '/context/wishlist.do?id=%27%2Bid%2B%27'


Any hint?

Thanks in advance!

-- 
Gustavo Straube Pereira
gustavo.pereira@nobla.com.br

Nobla Software S/A
www.nobla.com.br
(41) 3018 3735


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org


Re: Problem with $link.setAction and Javascript

Posted by Nathan Bubna <nb...@gmail.com>.
The LinkTool automatically performs URL encoding on query data.  The
easiest way to avoid it is to add the parameter manually:

$link.setAction('wishlist')?id='+id+'

On 12/8/06, Gustavo Straube Pereira <gu...@nobla.com.br> wrote:
> Hi!
>
> I want to parse a link to an action with some javascript variable, like
> this:
>
>   var id = 1;
>   window.location =
> '$link.setAction("wishlist").addQueryData("id","'+id+'")';
>
>
> I've expected this:
>
>   '/content/wishlist.do?id='+id+''
>
> But my output looks like this:
>
>   '/context/wishlist.do?id=%27%2Bid%2B%27'
>
>
> Any hint?
>
> Thanks in advance!
>
> --
> Gustavo Straube Pereira
> gustavo.pereira@nobla.com.br
>
> Nobla Software S/A
> www.nobla.com.br
> (41) 3018 3735
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org