When creating a new widget, create new or clone widget, the identification and replacement of the invalid characters in the ID field of the widget is different between Service Portal and the standard UI.
- In the Service Portal widget editor, the ID field replaces all invalid characters that are not A-Z, 0-9, underscore or hyphen with an underscore
- In the standard UI, the ID field is updated on the change of the field to replace all invalid characters that are not A-Z or 0-9 with a hyphen
Steps to Reproduce
- Service Portal
- In the Service Portal Widget Editor, add a new widget or clone a widget.
- In the Add a Widget or Clone Widget dialog, enter some text in the Name field that includes spaces.
- The ID field is automatically populated, and all spaces are replaced with underscores.
- The ID value can be modified to include a hyphen.
- Standard UI
- In the List view for the sp_widget table, create a new widget, or clone an existing widget.
- In the new widget form, enter text in the ID field that includes spaces.
- The ID field is updated after the change is made, upon selecting a different field, and replaces all spaces with hyphens.
- Modify the ID field to add an underscore, the ID is updated on change to replace underscores with hyphens.
The standard UI only allows letters A-Z and numbers 0-9 as valid values, and all other characters are replaced with hyphen.
The Service Portal is inconsistent with the standard UI due to the Client Script Ensure Valid Widget ID.
The script includes the line:
var fixedValue = s.toLowerCase().replace(/[^a-zA-Z0-9]/g, "-");
To make the standard UI behave the same as the Service Portal, use the following:
var fixedValue = s.toLowerCase().replace(/[^a-zA-Z0-9-_]/g, "_");
Related Problem: PRB1201227