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 07:58 AM
Thanks! It looks like some things did change in Berlin. I've just updated the SNGuru article with a new script that should work. The problem is with the escaping of spaces in the tab name. If you remove the spaces from your form section or tab names then you shouldn't have to worry about this breaking in the future. Give the updated script at SNGuru a try and let me know how it goes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2012 08:09 AM
Mark,
Indeed it works. Even in IE 8!
So, my next question, is there a way I can put this as a function and not have to paste the code every single time? I have put scripts in "Script Includes" before but for AJAX. Is this something I could do as well?
Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2012 08:38 AM
The way to do that with a client script is to use a UI script and check the 'Global' checkbox. You can take my code and put it in a function that accepts the tab name as a parameter. UI scripts can be found under the 'System UI' application.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2012 11:24 AM
I did that but it doesn't respond unless I do a setTimeout or an alert to delay the script. Not sure why. Any ideas?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2012 11:31 AM
If you're running it on load, and you're running it in Berlin, the setTimeout might be necessary. If that's not the case, it should work without issue.