Client Script Action to click on Section tab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2012 05:47 AM
We have a group of fields on a form that are required and in a Section tab, if you click on a "Close" button then it will start the Client Script to check if they have been filled in. If you have the tab open and you add some mandatory fields then it will go right to that field. However, if you are not selected on that tab, it takes you to the tabs but you have to select on the tab that is Red.
I would like to go one further and have that tab automatically open upon click of the "Close" button. Is there a trick with SN to do this or do I have to employ CSS?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2012 05:54 AM
Answer:
http://www.servicenowguru.com/scripting/client-scripts-scripting/changing-active-tab-selection-servicenowcom/

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2012 05:55 AM
http://www.servicenowguru.com/scripting/client-scripts-scripting/changing-active-tab-selection-servicenowcom/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2012 06:02 AM
Mark,
Firstly it's an honor to have you reply to one of my posts, my work talks highly about your site and I have had the pleasure of using it as a bible. Secondly, thank you for the link! I am trying to implement it now. Not 100% if this is Berlin friendly or not, I'll let you know.
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2012 06:08 AM
Mark,
Yep, the actual code itself doesn't work...
var tabName = 'Change, Backout, and Test Plan';
var myTabs = $('tabs2_section').select('h3[class="tab_header"]');
var answer = 0;
for (i = 0; i < myTabs.length; i++) {
var inner = myTabs<i>.innerHTML.replace(/ /g, ' ');
if(inner.indexOf(tabName) > -1) {
answer = i;
break;
}
}
//Display the selected section
g_tabs2Sections.setActive(answer);
However, the simple answer using the number works:
g_tabs2Sections.setActive(3);
I assume some changes in Berlin took place. I am too busy to figure out what, but this is fine for now.
Thanks!