Hi,

I'm in process of migrating to wicket 1.5-M1 and I found an interesting (at
least to me) scenario: 
There is a form "Form1" in a stateful page Page1. The "action" attribute of
the form contains the id of the page and after the form is submitted the
page is retrieved on the server according to the given id in the form
action. 
Inside Form1 there is a markup container "C1" and in it a check box (Chkb1)
with an OnChangeAjaxBehavior attached to it. When the Chkb1 is checked a few
more fields are added to C1 via Ajax (and therefore in Form1). On the server
side only C1 is added to the AjaxRequestTarget object. In this case the Id
of Page1 is incremented, however only C1 "knows" about this, since this is
the only component updated after the ajax call.
After this, when Form1 is submitted the id in the "action" attribute is not
the most recent one and the result in my case is that after the Page1 is
reloaded it is in the same state as the one before the ajax update.

A pseudo html below:

<form wicket:id="Form1">                                           <!--
Form1 is not updated on the ajax call -->
                                                <!-- C1 is updated on the
ajax call -->
         <input type="checkbox" wicket:id="Chkb1" />
        
          ............................                                          
 
<!-- the new fields are added here -->

     
     <input type="submit" wicket:id="submit_button" value="submit" />
</form>

This worked in 1.4.9. I think that if Form1 is updated also when Chkb1 is
clicked this would work. However in this case the whole form have to be
"rebuild", and not only C1. This is a very specific example, but I think
that in the practice there is a wide range of similar scenarios.

Is there a more elegant solution for this case? Thanks in advance.

Regards,
Ivan Vasilev
-- 
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Ajax-requests-and-page-Id-incrementing-in-1-5-M1-tp2527218p2527218.html
Sent from the Wicket - User mailing list archive at Nabble.com.

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

Reply via email to