please try this: href=ognl:answer
and in public String getAnswer() { return new String ( javascript:alert(" ' "+ ognl:model.answer.toString() + " ' " ); } i recommend you use view source to see the generated HTML and tweak things here and there - with a little trial and error you'll get it right in 5 attempts!! :-) On 8/4/06, Rui Pacheco <[EMAIL PROTECTED]> wrote:
I changed my code to this: <a jwcid="@GenericLink" href='javascript:alert("ognl:model.answer")'> <img height=40 alt="" src="imagens/IAdv.gif" width="63" border="0"> </a> But now I get an alert saying "ognl:model.answer". On 8/4/06, Karthik N <[EMAIL PROTECTED]> wrote: > > each value of your For loop is stored in the ognl:model > > so for your href you need to access the model object to create the alert > javascript. > > On 8/4/06, Rui Pacheco <[EMAIL PROTECTED]> wrote: > > > > Jesse, how can I access the model in your example? I tried your snippet > > and > > it generates an exception. > > > > On 8/4/06, Jesse Kuhnert <[EMAIL PROTECTED]> wrote: > > > > > > The @Any component is great for this. You can attach a jwcid="@Any" to > > > automatically "decorate" existing random html elements without > > necessarily > > > doing anything specific to one component. > > > > > > In your case (as previously suggested), you could add the jwcid="@Any" > > and > > > then do something like: > > > > > > href="ognl:'alert('+myModel.getId()+')" > > > > > > P.S. You don't need to put javascript: in front of javascript > statements > > > on > > > element nodes anymore. > > > > > > On 8/4/06, Rui Pacheco <[EMAIL PROTECTED]> wrote: > > > > > > > > Sorry, I guess an example is the best way to show my problem: > > > > <tr jwcid="@For" source="ognl:riddleList" value="ognl:model" > > > element="tr"> > > > > <td class="texto2"><span jwcid="@Insert" value="ognl:model.riddle > > > "/></td> > > > > <td width="65"> > > > > <a href=javascript:alert(1)> > > > > <img height=40 alt="" src="imagens/IAdv.gif" width=63 > > > > border=0> > > > > </a> > > > > <a href=""> </a> > > > > </td> > > > > </tr> > > > > > > > > I want my want to be generated dinamically. The number comes from > the > > > > database, inside an object called Model. How can I place it there? > > > > > > > > > > > > > > > > On 8/4/06, Jesse Kuhnert <[EMAIL PROTECTED]> wrote: > > > > > > > > > > Yes, also don't forget the power of "this" and how it changes > > > depending > > > > on > > > > > context. I'd have to see your code but it's quite possible that > you > > > can > > > > > navigate from "this" to any dom node in your browser if "this" > > points > > > to > > > > a > > > > > dom node. > > > > > > > > > > On 8/4/06, Karthik N <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > i guess i'm not too clear what you want to achieve: > > > > > > > > > > > > i suppose you can have an informal parameter > > > onclick=ognl:clickAction > > > > > and > > > > > > then create the javascript in the getClickAction which forms the > > > > string > > > > > > based on the current ID > > > > > > > > > > > > On 8/4/06, Rui Pacheco <[EMAIL PROTECTED]> wrote: > > > > > > > > > > > > > > Hi all > > > > > > > > > > > > > > I need to pass a parameter to a JS alert(). This is repeated > in > > > > > several > > > > > > > rows > > > > > > > of a table created with a @For component, and the parameter is > > the > > > > id > > > > > of > > > > > > > the > > > > > > > elements of the current row. Passing <span> will of course > break > > > the > > > > > JS > > > > > > > function and the HTML its in. > > > > > > > > > > > > > > Can anyone please sugest a different solution? > > > > > > > > > > > > > > -- > > > > > > > Cumprimentos, > > > > > > > Rui Pacheco > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > Thanks, Karthik > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > Jesse Kuhnert > > > > > Tacos/Tapestry, team member/developer > > > > > > > > > > Open source based consulting work centered around > > > > > dojo/tapestry/tacos/hivemind. > > > > > > > > > > > > > > > > > > > > > > -- > > > > Cumprimentos, > > > > Rui Pacheco > > > > > > > > > > > > > > > > > -- > > > Jesse Kuhnert > > > Tacos/Tapestry, team member/developer > > > > > > Open source based consulting work centered around > > > dojo/tapestry/tacos/hivemind. > > > > > > > > > > > > -- > > Cumprimentos, > > Rui Pacheco > > > > > > > -- > Thanks, Karthik > > -- Cumprimentos, Rui Pacheco
-- Thanks, Karthik