The alternative to hiding a link on the page (if you want a better
separation of logic) is to pass a JSonObject with your data directly
to the JavaScript method. This way if you need to you can easily pass
additional data to the client for processing.

So at the top of your class
@Import(library = "foo/your-file.js")

Example:
        void afterRender()
        {
                Link youUrl = resources.createEventLink("yourAction");

                JSONObject spec = new JSONObject();
                spec.put("yourUrl", yourUrl.toURI());
                .....

                javascriptSupport.addInitializerCall("yourJs", spec);
       }

Javascript:

Tapestry.Initializer.yourJs = function(spec)
{
...
}

On Fri, Jan 14, 2011 at 10:45 AM, Adam Zimowski <zimowsk...@gmail.com> wrote:
> Thanks Thiago! I'll take a look at these examples.
>
> @Michael - how clever !! This may be just the shortcut I needed.
>
> Adam
>
> On Fri, Jan 14, 2011 at 10:40 AM, Michael Taylor <miketay...@google.com> 
> wrote:
>> My first thought would be to include the action link in the page somewhere,
>> but set its style to "display: none".
>> Then your JavaScript can do something like
>>
>> document.location.href = document.getElementById('myActionLink').href;
>>
>> In the past I've done something similar to trigger a zone update from inside
>> a JavaScript function.
>>
>>
>> Cheers,
>>
>> Mike T
>>
>> On Fri, Jan 14, 2011 at 11:27 AM, Adam Zimowski <zimowsk...@gmail.com>wrote:
>>
>>> Hi
>>>
>>> I have a feeling like this is so simple and I'm missing something
>>> really obvious. I have a question on the recommended approach for a
>>> specific scenario:
>>>
>>> An HTML button showing a JS popup rendered via Ajax. Here is specific
>>> example:
>>>
>>>
>>> http://www.chdist.com/industrial-safety-supplies/personal-protective-equipment/d-106931-106931-153343
>>>
>>> This is a struts app which I'm converting to Tapestry. On go-live,
>>> other than URLs, it must look exactly like current production so I
>>> have to preserve the look-and-feel as well as the behavior.
>>>
>>> My question is, how should I approach this? Currently, the price
>>> button invokes a JS call. So how can I call actionlink URL from a
>>> JavaScript?
>>>
>>> Adam
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

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

Reply via email to