On a record view page with tabs (and AJAX Tab Loading = enabled), is there a way I can have a Javascript function executed "on tab load" (since the onload property only works for the first Tab displayed when page is initially loaded)? I know I could disable AJAX page loading, but the Record View page would take too long to load if I did. Thanks
There are several things we can do:
1. Provide option to run onLoad scrip every time the tab changes (this may lead to unwanted effects potentially)
2. Allow new script "on tab change" feature
3. Treat "disable AJAX page loading" as full page refresh (perhaps the safest thing to do).
Please let me know what do you think.
#1. This would work as long as we remember to check that the function exists on the current tab before calling it to avoid JS errors.
onload:
if (typeof updateFees == 'function') updateFees();
#2. This may be the best way to do it. Add an additional text box on page properties where we can identify script to run "on tab change" similar to how "onload" is done.
#3. Would also work, but the AJAX tabs are a nice feature. Why refresh the whole page when it's not needed?
OK, will proceed with #2
That is only available on View pages - we do not have tabs on New Record pages.
Oh my mistake, I was looking at the wrong page!
Sorry to keep bugging you with this..
The "ontab" change feature will only work when AJAX tab loading is disabled? I thought it was supposed to work with AJAX tab loading enabled.
The whole reason of having the "ontab" change (in my mind, anyway) was to be able to still use AJAX tab loading (since it's quicker than loading all tabs at once), but also be able to run Javascript when a new tab is loaded.
AJAX loading is not friendly to JavaScript. You're safe when entire page is loaded at once.
Got it.. Thanks