You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Deon Visagie <de...@sebrio.com> on 2006/06/06 14:08:45 UTC
OGNL in javascript
Hi All
I want to put an ognl expression in my onclick event of a link
e.g: onclick="ognl:'javascript: document.getElementById('userId').value=' +
user.Id"
but the above doesn't work. I have tried various variations with no success.
I know onclick="ognl: user.Id" would print out the id but I need to append
it to a string.
Can it be done?
Thanks,
Deon
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: OGNL in javascript
Posted by Christian Haselbach <ch...@tngtech.com>.
Quoting Deon Visagie <de...@sebrio.com>:
> I want to put an ognl expression in my onclick event of a link
> e.g: onclick="ognl:'javascript: document.getElementById('userId').value=' +
> user.Id"
I'd say there is a syntax error with the single quotes, which occure
in the getElementById call. If escaping these does not work you can
try something like onclick="ognl:makeJavascript()" and implement
String makeJavascript() in the coressponding class to return the
desired string.
Regards,
Christian
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: OGNL in javascript
Posted by Jesse Kuhnert <jk...@gmail.com>.
You might also want to take a look at the @Script templating ability in
tapestry. It simplifies more complicated scenerios such as what you
describe.
http://jakarta.apache.org/tapestry/UsersGuide/script.html
On 6/6/06, Andreas Andreou <an...@di.uoa.gr> wrote:
>
> if, by any chance, you have a tacos jar in your classpath, you can take
> advantage
> of the template binding, i.e.
>
> onclick="template:javascript: document.getElementById('userId').value=${
> user.Id}"
>
> Also, you don't have to add "javascript:" in the onclick attribute.
>
> Deon Visagie wrote:
> > Thanks! It worked.
> >
> >
> >
> > -----Original Message-----
> > From: Inge Solvoll [mailto:inge.tapestry@gmail.com]
> > Sent: 06 June 2006 02:26 PM
> > To: Tapestry users
> > Subject: Re: OGNL in javascript
> >
> > You have to escape the ('userId'), like this probably: (\'userId\')
> >
> > On 6/6/06, Deon Visagie <de...@sebrio.com> wrote:
> >
> >> Hi All
> >>
> >> I want to put an ognl expression in my onclick event of a link
> >> e.g: onclick="ognl:'javascript: document.getElementById
> ('userId').value='
> >> +
> >> user.Id"
> >>
> >> but the above doesn't work. I have tried various variations with no
> >> success.
> >> I know onclick="ognl: user.Id" would print out the id but I need to
> append
> >> it to a string.
> >>
> >> Can it be done?
> >>
> >> Thanks,
> >> Deon
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Jesse Kuhnert
Tacos/Tapestry, team member/developer
Open source based consulting work centered around
dojo/tapestry/tacos/hivemind.
Re: OGNL in javascript
Posted by Andreas Andreou <an...@di.uoa.gr>.
if, by any chance, you have a tacos jar in your classpath, you can take
advantage
of the template binding, i.e.
onclick="template:javascript: document.getElementById('userId').value=${user.Id}"
Also, you don't have to add "javascript:" in the onclick attribute.
Deon Visagie wrote:
> Thanks! It worked.
>
>
>
> -----Original Message-----
> From: Inge Solvoll [mailto:inge.tapestry@gmail.com]
> Sent: 06 June 2006 02:26 PM
> To: Tapestry users
> Subject: Re: OGNL in javascript
>
> You have to escape the ('userId'), like this probably: (\'userId\')
>
> On 6/6/06, Deon Visagie <de...@sebrio.com> wrote:
>
>> Hi All
>>
>> I want to put an ognl expression in my onclick event of a link
>> e.g: onclick="ognl:'javascript: document.getElementById('userId').value='
>> +
>> user.Id"
>>
>> but the above doesn't work. I have tried various variations with no
>> success.
>> I know onclick="ognl: user.Id" would print out the id but I need to append
>> it to a string.
>>
>> Can it be done?
>>
>> Thanks,
>> Deon
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
RE: OGNL in javascript
Posted by Deon Visagie <de...@sebrio.com>.
Thanks! It worked.
-----Original Message-----
From: Inge Solvoll [mailto:inge.tapestry@gmail.com]
Sent: 06 June 2006 02:26 PM
To: Tapestry users
Subject: Re: OGNL in javascript
You have to escape the ('userId'), like this probably: (\'userId\')
On 6/6/06, Deon Visagie <de...@sebrio.com> wrote:
>
> Hi All
>
> I want to put an ognl expression in my onclick event of a link
> e.g: onclick="ognl:'javascript: document.getElementById('userId').value='
> +
> user.Id"
>
> but the above doesn't work. I have tried various variations with no
> success.
> I know onclick="ognl: user.Id" would print out the id but I need to append
> it to a string.
>
> Can it be done?
>
> Thanks,
> Deon
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: OGNL in javascript
Posted by Inge Solvoll <in...@gmail.com>.
You have to escape the ('userId'), like this probably: (\'userId\')
On 6/6/06, Deon Visagie <de...@sebrio.com> wrote:
>
> Hi All
>
> I want to put an ognl expression in my onclick event of a link
> e.g: onclick="ognl:'javascript: document.getElementById('userId').value='
> +
> user.Id"
>
> but the above doesn't work. I have tried various variations with no
> success.
> I know onclick="ognl: user.Id" would print out the id but I need to append
> it to a string.
>
> Can it be done?
>
> Thanks,
> Deon
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>