No, there are no native APIs for shifting focus. Y...
# suitescript
e
No, there are no native APIs for shifting focus. You'll have to do that yourself with jquery or JS DOM APIs
b
ugh... bummer. Thanks for the reponse.
e
And be aware that these sorts of manipulations aren't supported by NS, so they reserve the right to change the HTML structure at will, without notification
πŸ‘πŸ» 1
s
@badgerdigital Not a real solution, but depending what you are doing, you could try doing somethign with the url. Adding `&selectedtab=shipping`makes the page load on the shipping tab. It would cause the page to reload after loading initially but does accomplish the goal.
b
@Sandii Thanks, I'll make a note of that, interesting.
s
It works for any custom tab as well, you just need to inspect the element to know what name to use, usually
custom#
b
In my instance I'm already in edit mode, so I don't think this would be feasible. Looks like I'll go the jquery route.
s
It will work in edit mode, just need to get current URL with
window.location.href
and append the select tab to end
Page will almost finish loading, then restart. You need to add some logic on the client to look for that param in the url, or you will get runaway train of page reloading
b
Yeah, in my case, I ulitmately want this to fire on a field changed, which means I need my changes to persist. So a reload would kill those changes.
s
Oh yeah that makes sense, good luck with the jQuery. Fun and annoying at the same time.
p
It’d be good if NS had an API for it - has anyone searched for an enhancement request?
c
@PNJ enhancement request - hahahhaha
I've seen ones 8 years old.
a
But I mean, just use a function called "changeTab" and implement the location.href (if different than the current) and test it 10 minutes in a leading account each time Netsuite change version (so months before the production live) in case you need to change the JS management of TAB switching after the new version stop working
p
@Craig 🀭
😊 1
b
If you inspect the code behind the tab, there is a call to a function
ShowTab()
. I was able to use this in the pageInit. For example,
ShowTab("packages", false)
. I have no idea what the 2nd parameter does. Of course all of this is undocumented/unsupported. If your form is in "expanded mode" (no tabs), the call to
ShowTab()
will generate an exception.