Hi all,

thanks in advance for your precious support.

I have an AjaxTabbedPanel with two tabs. In the first tab there is a
panel with a form, some input fields and a save button; the content of
the second tab is irrelevant.

Use-case:

1 - user selects first tab;
2 - user makes some changes in the input fields but doesn't click the
save button;
3 - user selects second tab.

On step 3, users loses all his updates without being warned.

I would like to add a javascript confirm dialog to be triggered only
when some changes have been performed but not saved (no ModalWindow,
just javascript). I mean something like: "There are some unsaved
changes that will be lost, do you really want to switch tab?" <OK>
<Cancel>. OK brings the user to the second tab, Cancel makes him stay
in the first tab.

The panel inside the first tab has a handy boolean hasUnsavedChanges()
method, but I don't know where I could call it and how to inject an
"if (!confirm('...')) return false;".

Maybe in the onClick(AjaxRequestTarget target) method of the
AjaxFallbackLink returned by AjaxTabbedPanel's newLink() method?

What's the best way to do it?


Thank you very much,

Fabio Fioretti - WindoM

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to