I've been searching for help with this issue on the web concerning URL 
modifications that we need to do from doing an AJAX request (for example adding 
a sort parameter when a sort option is selected but stay on the page).  We 
don't want to do a redirect and have the redirect added to the history (i.e. 
back button), and we are refreshing only the necessary components on the page 
(see related link:  
https://stackoverflow.com/questions/6576354/changing-url-via-ajax-using-wicket).

However a couple of the components need to be refreshed with the slightly 
updated url.  For example the Form component on the page, the action URL needs 
to be updated so when requests come from combo boxes during the onChange() 
event will have the right request URL.

What is the best way to make this work.   Here is what we are doing now and 
what is happening:


  1.  Combo Box drop down causes an AJAX event (i.e. sort selection), during 
the event javascript is generated to update the browser URL using the 
AjaxRequestTarget. appendJavaScript().  (The javascript updates the url using 
the history API).  Other components are refreshed on page as needed.
  2.  Another combo box on the page then is then selected causing another AJAX 
event, and in this case the wrong request URL is given (it is the old original 
one).  Looking at the page source the action url for the form has the old url.

Thoughts on how to make this work?  Can we do a complete page refresh/redirect 
to not affect history or somehow let Wicket know during the AJAX event that the 
URL will be changed and this is the one to use to refresh the components with 
(especially the form action url)?

Thanks in advance,

Mike

Reply via email to