On 01/08/15 15:50, Boris Goldowsky wrote: > If I¹m understanding you correctly, wouldn¹t it be sufficient to code this > as > a simple AjaxLink, which responds with a regular AJAX > update when the link is disabled, or uses setResponsePage when it¹s > enabled?
The link in question delivers a PDF document, and has target="_blank" to do that in a new tab. In fact, there are several of these links, and only some of that have the controlling behavior. Thus prevention of the default action is essential, to prevent opening a new tab. I also had a solution that used window.open() in JS -- but that code wasn't any prettier. I think what I'm looking for is a way to add some client data to an ART target that I can access client-side, e.g., in an AJAX call listener. Thanks for your comments, Joachim > On 1/7/15, 9:15 PM, "Joachim Schrod" <jsch...@acm.org> wrote: > >>Hi, >> >>I have a class of links where some of them sometimes shall not >>trigger. The decision is made server-side according to current state. >> >>At first sight, the realization seems to be not that straight forward: >> -- I add an AJAX behavior to these link that allows default action >> and computes if the link action shall be prevented. >> -- The AJAX behavior has an AJAX call listener (complete handler) >> that may call attrs.event.preventDefault() if the link shall >> not be triggered. >> -- The decision if the link shall not be triggered is >> communicated by the AJAX request to the complete handler via >> an HiddenField that is updated in the AJAX request. Delivery >> of the decision via JSON is difficult, as we also want to >> update other DOM elements with the response (feedback why the >> link was not triggered). >> >>Do I miss something? Is there a completely different approach that >>I could take? >> >>Or: Is there a better way to communicate the decision if the link >>shall be triggered to the call listener? Introducing a hidden field >>for that purpose seems to be awkward, for me. >> >>I would be thankful for any comments or recommendations. >> >> Joachim >> -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Joachim Schrod, Roedermark, Germany Email: jsch...@acm.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org