Is there a way to execute JavaScript when switching tabs on the web in a tabbed table? I’d like to run a validation script when the user switches tabs.
Subject: Javascript event on tab change
The form will be submitted on a tab change, so you can use onsubmit.
Subject: And be careful
You have to make sure to validate only the fields that are on the current tab. The onSubmit event doesn’t know which fields are “validatable” when it runs so you have to include tests to check. I did this by checking whether one field on a tab was not hidden, e.g.,
var f = document.forms[0];
if ( f.Tab1Field.type != “hidden” ) {
[validation script for fields on tab 1]
}
Subject: RE: Javascript event on tab change
Which is one reason I like to re-do tabbed tables. That constant Submit action isn’t always desirable. Rather, using some
Collin
KC8TKA
Subject: Javascript event on tab change
Thanks for the replies. I didn’t know that the tab change did a Submit, so that is very useful to know.