
petercawdron
Kilo Guru
Options
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 11-24-2019 05:39 PM
This is a nice little script that brings an out-of-sight field on an unfocused tab to the forefront when the user takes an action.
As an example, a user is working on a change task and hits Cancel Task.
But we want the user to enter closure information when cancelling the task, so we want the Closure Information tab to get the focus like this...
Here's the UI Action that controls this behavior
function moveToClosed() {
if(g_form.getValue('close_notes')==''){
g_tabs2Sections.setActive(1);//sets the second tab to active (the first tab is 0)
g_form.setMandatory('close_notes',true);
g_form.addErrorMessage("You must provide close notes to cancel this task");
}else{
g_form.setValue('state', 4);
gsftSubmit(null, g_form.getFormElement(), "change_task_to_cancelled");
}
}
if (typeof window == 'undefined')
setRedirect();
function setRedirect() {
current.update();
}
Have fun!
Labels:
- 1,764 Views
Comments
James Fricker
Tera Guru
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
03-10-2022
07:05 PM
Instead of this...
g_tabs2Sections.setActive(1);
I think this is more readable...
g_form.activateTab(g_form.getTabNameForField('close_notes'));
plus, it still works if the close_notes field gets moved to a different tab.