For anyone interested I solved the problem I was having by changing the
onClose() method in setWindowClosedCallback in BasePage.java to the
following:
public void onClose( AjaxRequestTarget target )
{
Form form = (Form) BasePage.this.get( "baseForm" );
HiddenField field = (HiddenField) form.get( "confirmResultField" );
target.addComponent( field );
doConfirmAction( target );
}
I also removed the adding of the resultfield to the target in the onSubmit
methods in the ConfirmPage class and the AjaxFormComponentUpdatingBehavior
on the confirm field.
In my application the doConfirmAction() method checks the value of the
hidden field. If it is "Yes" it does some DB updates. When finished it
sets a result message in the PageParameters object and then calls
setResponsePage(new MyPage( parms )) to open up the previous page with the
changed values. The message is added to the feedback panel in
onBeforeRender() when the page opens.
So the use case would be something like select a user from a user list page
and open a user edit page. When edits are done click the Save button. If
there are no validation errors open the modal window to confirm the
operation. If the user clicks Yes update the DB, add a message to be
displayed to page parameters and set the response page to the user list
page. If the user clicks no just reopen the user list page.
Jim
jnorris wrote:
>
> Hi All,
>
> I'm trying to use a ModalWindow for a confirmation dialog. Based on the
> button clicked I'm setting a value in in a hidden field that has an
> AjaxFormComponentUpdatingBehavior that I'm trying to use to invoke an
> action method based on the user selection. I want to reuse this for pages
> that use a confirmation dialog so I have it in a base page. Everything
> works as expected except that the onchange method on the hidden field is
> not invoked. I've attached a quickstart that illustrates what I am trying
> to do with the hidden field replaced by a text field. The field value
> does change based on which button in the modal window is clicked.
> However, the onUpdate method for the text field at line 64 in
> BasePage.java is never called.
>
> If anyone can take a look at this and help me out I'd appreciate it.
>
> Also if there is a better way to do a confirmation dialog that invokes a
> method when the Yes button is selected I'd be interested in hearing how to
> go about http://www.nabble.com/file/p18831847/ModalTest.zip ModalTest.zip
> it.
>
> Thanks,
> Jim
>
--
View this message in context:
http://www.nabble.com/Help-with-ModalWindow-tp18831847p18836701.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]