How can I clear the PropertyModel's value when I hit back on my browser - apache

I have a DropDownChoice with a PropertyModel in my page and I have some other actions which take me to different pages. Now when I click on the Back Arrow on my browser, I come to my page which has the DropDownChoice with the previously selected choice. I understand PropertyModel holds the value for me. But how can I get rid of it when I hit Back button and why is the onBeforeRender(both on the class as well the Component) not working when I hit the Back button. Please comment if my explanation is not clear enough. I am using Wicket 1.4.8

onBeforeRender doesn't work because it's never called. When you navigating using "Back" button, no new request are sended to your server, hence page rendering never occurs. The only way to solve your problem - is to use javascript.

Related

NavigateTo same page again does not refresh?

I have 2 pages in my Windows Phone 8 XAML app, "MainPage" and "Play".
I NavigateTo Play from MainPage, then hit the back button to return to MainPage.
Once I NavigateTo Play again, 2 things happen that I find confusing:
My constructor for Play is called again, yet the controls on the page still contain data from the last page visit.
Even though I see data in page members the data does not render on the screen.
There's something basic here I'm missing? How do I either get a completely new page; or re-render the previous instance?
Thanks
-John
You can use different class to hold your data, I think that is the problem. You can see this for more info.

pushState on existing url, on refresh cause double url in history

I've a problem. obviously.
First of all, sorry for my bad english. Then...
I'm using History.js for pushState and other function of History API in HTML5. But this is not the point.
example:
i've this url, generated with pushState, www.mysite.it/picture/2, that show a lightbox with the picture. When i load more images, with keypress or click, the pushState change the url to the next (or previous) url (ex. www.mysite.it/picture/3).
The problem is this: When i refresh the page, the site poin to the real page of www.mysite.it/picture/2, and it's ok, but, when i click on the BACK button i've in history the same url (www.mysite.it/picture/2) for the second time. I think that this happen because when i refresh i create e new history row.
...i dont know how to solve this problem. Please, help :)
Problem Solved
i've writing the pushState function outside of the if that determinate what key the user have pressed. So, when cntrl+r was pressed for refresh, another row was added to the history. xD

Javascript back on two consecutive pages

So, I ran into a problem: I have 2 (or more) consecutive pages, which the user can click through. At the bottom of each page there's a "Back" button (with Javascript's history.go(-1);), so that the user is able to go back to the previous view.
Now my problem is: When the user is on page 3 and clicks on the button, he goes back to page 2 (until here everything's fine), but when he's back on page 2 and clicks on the back button on that page, instead of going even further back to page 1, he gets sent back (or forward?) to page 3.
Is there a solution to this problem, I tried Google, but couldn't find anything.
Thanks in advance! :)
Your problem is that the Javascript is behaving exactly as it should in returning the browser to the previous page. Could you not handle your navigation between pages more explicitly? Replacing the history.go(-1) with a link to the actual script\page?
Use window.location to send the user back to previous page instead of history.go(-1). If the user lands on the second page in your flow, the back button will be useless.

Where can I read how to make web notifiers such as the StackExchange at the top left side of StackOverflow screen?

I'm not even sure what the name of that is to be able to make a search... but I would like to make those kind of things. Facebook has that too with the messages, notifications and friends requests. Thanks
I'm not sure if you expect anyone to give you a complete tutorial with source code included? :) You should probably do some digging around yourself, since a concrete answer on this could mean to write a few pages :)
How can you dig around?
Thé tool for a job like that is Firebug (IMO).
With bigger tasks like these it makes sense to try to split it up in smaller pieces.
Let's say you go for a widget like the user profile popup on SO.
you need some HTML to display in a popup: right click on any html element on the popup and click the 'inspect element' menu item. This brings you to the HTML tab in firebug. This allows you to figure out how the HTML is structured
you need some CSS to style that popup: when you're browsing the html structure, you might already have noticed that on the right side of it is the CSS that is applied to the active element
you might want to use some animation effects: for that you could use jquery. Have a look here to find out more on which effects are available and how they can be triggered. Fading is used in the profile popup on SO.
then you might ask yourself the question where SO get's that html structure from, right? To find out more about which server calls are made you can use the 'NET' tab in Firebug. (When you hover over your user name (only the first time?), then you should notice there's a call made to something like: http://stackoverflow.com/users/profile-link-stats?_=someLongNumberHere
In firebug you can then inspect the request and response. You should notice that the response is some HTML structure. This HTML structure is then inserted into the DOM.
Sooooo you can kinda glue it all together now:
the user hovers over his user name
the hovering triggers a server call (see step 4): use jquery hover to attach a handler to the user link. (subsequent hovers don't trigger that server call, so there needs to be a check to see if that profile popup was already loaded or not)
when the server call successfully returns (see jquery get), the returned html is inserted into the DOM and a fadeIn effect is triggered.
it seems a mouseout is used to fadeOut the popup
I HOPE this is the answer you were looking for. It took me a while ;)
You probably need to check out stackapps

Web part lost when page post back

Here is the brief detail of issue.
I have Page1 where I have put LinkButton. The LinkButton Has property PostBackUrl pointing to Page2.
When user is redirected to page2, I am using Page Load method to access controls from previous page & get the needed value. To make clear, I am using this approach becuase I cant use querystring.
Page 2 has 2 web parts on it. The web parts use data received in Page Load event from page1 and renders data.
This works perfect on first page load. When user clicks on a URL in page which posts back, the web parts gets lost.
Note that if I come directly to page2 without going at page1, then web parts are retained in the page and they are not lost.
Can anyone give me the clue of issue cause?
Thanks in advance.
Do you have any debugging enabled? you are most likely looking for values on page load that don't exist and might be getting exceptions that aren't handled properly.
I am not sure why but somehow code was throwing an exception when I tried to access the property Page.PreviousPage. Though I had made sure to check null on each step. Even code was never get hit when web part was lost. So it is still a mystery for me.
Just in case someone comes across this issue my workaround may help. I used Post back to page2 using post method. I accessed the variables using Page.Form[] variables. This way my issue of getting web parts lost got resolved.