Description
g_form.showFieldMsg scrollForm does not work in CMS.
Steps to Reproduce
The [scrollForm] behavior documented in the 'g_form.showFieldMessage' method does not work in CMS; scrolling to the message only works in non_CMS.
- Log in to a Fuji instance.
Note that glide.ui.scroll_to_message_field is true in the base system. - Navigate to Service Catalog > Categories > Maintain Items.
- Select any active catalog item (for example, Apple iPhone 5).
- Add a new yes/no checkbox (test1) variable with the lowest order value so it displays at the top.
- Add a new Multi Line Text (comments1) variable with the highest order value so it displays at the bottom.
- Add the Catalog Client Scripts -> Catalog Item related list to the catalog item form by using Configure > Related List.
- Name: setFocus
- Applies to: A Catalog Item
- Active: true
- UI Type: Desktop
- Application: Global
- Type: onChange
- Catalog Item: Apple iPhone 5
- Variable name: test1
- Applies on a Catalog Item view: true
- Script:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
g_form.showFieldMsg("comments1", "You need to populate Comments","info",true);
}
- From the Catalog Item record, click the Try It button.
- Change yes/no checkbox (test1) variable from Yes to No.
- Focus and auto-scroll to message and field specified (comments1).
- Launch CMS and repeat steps.
The message is displayed, but focus and auto-scroll does not occur.
Workaround
There are two options.
The first option is to display the message right underneath field (test1 in above scenario) by modifying script:
from:
g_form.showFieldMsg("comments1", "You need to populate Comments","info",true);
to:
g_form.showFieldMsg("test1", "You need to populate Comments below","info",true);
-or-
The second option is to force the focus to the field at the bottom of the form by modifying the script to:
g_form.showFieldMsg("comments1", "You need to populate Comments","info",false);
location.href="#";
location.href="#" + g_form.getControl('comments1').id;
Related Problem: PRB648044