Note that there are some explanatory texts on larger screens.

plurals
  1. POHiding javascript exceptions in tapestry
    primarykey
    data
    text
    <p>In Tapestry I have a situation where I redirect user from Page A to Page B, where sometimes he is redirected to page C before page B was shown. This results in following javascript exceptions shown as red pop-ups like this one appearing on the page:</p> <pre><code>Exception invoking function Tapestry.Initializer.activate with parameters ["example"]: TypeError: $(...) is null </code></pre> <p>All elements listed as null are from Page B, which I don't want or intent to show. I cannot directly redirect user from Page A to Page C in this scenario.</p> <p>I need a way in tapestry to handle those javascript exception by myself or hide them from appearing, or proper tapestry technique to redirect between pages without getting those errors. Currently I'm simulating user moving trough pages by launching redirecting code from @AfterRender function.</p> <p>Edit: I've added relevant parts of the code below</p> <p>On page one after user clicks modify I redirect him to user page</p> <pre><code>@InjectPage UserDataPage userDataPage; @OnEvent(value = EventConstants.ACTION, component = "modify") Object onModify(Long userToEdit) { userDataPage.setUserId(userToEdit); userDataPage.setEditDetails(true); return userDataPage; } </code></pre> <p>Since I really need to edit details UserDataPage does this:</p> <pre><code>@InjectPage UserDetailsPage userDetailsPage; @AfterRender Object setup() { if(editDetails) { userDetailsPage.setUserId(userToEdit); return userDetailsPage; } } </code></pre> <p>When UserDetailsPage loads it shows errors about components from UserDataPage that are missing(obviously, because I'm not on UserDataPage anymore). In Firebug I see that scripts contain all elemenents from both UserDataPage and UserDetailsPage. For example I have grid element on both pages, so resulting tapestry scripts refer both to grid and automatically renamed grid_0. Then the errors complain about missing grid from UserDataPage.</p> <p>I cannot go directly from list of users(first page) to UserDetailsPage, as UserDetailsPage requires that redirect comes from UserDataPage. I'm not allowed to get rid of that requirement.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload