Thank you, Igor, for getting back to me so quickly. Actually, thank you for
answering at all.
I thought of the onclick handler, but the AjaxFallbackButton doesn't have an
onClick() function. It does have a getOnClickScript() which I can override,
but I believe the timing will be off. I think it will fire before the form is
submitted. Hold on, I think I get what you're saying: write some JavaScript
AJAX for the onclick script that will call whatever routines I need to create
the user and then update the ListChoice's model. I don't need to do anything
with the onSubmit() overload. Is that what you're saying? I will try it. I
think it's a good idea.
An interesting aspect of this solution is that I don't think I even need a
form. I think the validation of control inputs would happen after the onclick
handler returns. I think this is a strictly roll-your-own solution.
Have I got it right?
From: Igor Vaynberg [EMAIL PROTECTED]
Sent: Thursday, October 02, 2008 4:42 PM
To: users@wicket.apache.org
Subject: Re: How to update ListChoice after form submission?
inside the onclick of your ajaxfallbackbutton you have to add the
listchoice to the target so wicket rerenders it
-igor
On Thu, Oct 2, 2008 at 12:49 PM, Seven Corners [EMAIL PROTECTED] wrote:
I have a page with a ListChoice of user names that is populated with a call
to our server (loadUserNames()). The page also contains a number of
TextFields corresponding to the user's other attributes. When you modify
those text fields so the user name doesn't correspond to anything in the
list, the Add AjaxFallbackButton enables. Click this, and you make a call
to the server which creates the new user.
The new user does not show up in the ListChoice. If you refresh the page,
it does, so we know it's created, and we know that loadUserNames() will
return the correct list if it were called and its values were used.. I want
the new user name to show up in the ListChoice after submission, and I'd
like to be able to set the selection in the ListChoice to the new user.
I've tried giving the ListChoice a LoadableDetachableModel, I've tried
giving it an ArrayList model with a call to loadUserNames() and setChoices()
on the ListChoice after submission, I've tried a
AjaxFormComponentUpdatingBehavior( onsubmit ), hoping this might fire
after submission, I've tried using a call to
getRequestCycleSettings().setRenderStrategy(IRequestCycleSettings.ONE_PASS_RENDER)
in my application class's init() method, I've tried a ton of things and I
can't figure this out.
Any ideas?
--
View this message in context:
http://www.nabble.com/How-to-update-ListChoice-after-form-submission--tp19786374p19786374.html
Sent from the Wicket - User mailing list archive at Nabble.com.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]