function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
JeriMorrisJeriMorris 

Control when a tabpanel switches to another tab

I have a VF page that uses the tabPanel and tab components. If the user clicks a tab's label to switch to a different tab, I don't want to switch to the new tab immediately. Instead, I'd like to see whether the user has made any changes to the form fields in the original tab. if so, I'd like to display a message asking if the user really wants to switch tabs without first saving his changes.

Is there any way (perhaps through JavaScript) to catch when a user has clicked on a tab's label? I've tried using the various event attributes of the tab and tabpanel components, and while some of them allow me to capture a click on the entire tab, none of them seem specific to a tab's label.

If I can determine whether the user has clicked on a tab's label, is there a way to control whether the page actually displays the contents of the clicked tab?

As a secondary issue, is there any easy way to determine whether the values of any of the form fields have changed? I can think of some ways to do this in JavaScript (for example, when the page is loaded, iterate over the form field values to remember their initial values, then iterate over them again later on to see if anything changed), but is there anything built into Apex to make this easier?

Thank you,

Jeri
Brendan LallyBrendan Lally
Good luck on that.
Tab panels doesn't seem 2b that mature - right now and don't c any xtra's in Winter 09 4 it

Lal