Describe the bug
When a field title contains a pair of parentheses, like Enter ABC (or DEF), the Fields.hide method does not work.
To Reproduce
Steps to reproduce the behavior:
- Assign a field title containing a pair of parentheses, like
Enter ABC (or DEF).
- Call the Fields.hide method on the field, like
Fields.hide("Enter ABC (or DEF)").
Expected behavior
The field should be hidden.
Desktop (please complete the following information):
- OS: Win 10 (64-bit)
- Browser: Internet Explorer
- Version: 11
Additional context
I suspect it's falling down in the getCell method where the title is passed in as a regex pattern for matching, and the parentheses are being interpreted as a regex grouping. (When stepping through the code in the debugger, html comes back as null on this field.)
getCell: function (fieldDisplayName) {
var theCell = $(".ms-formbody").filter(function (i, o) {
var rx = 'FieldName=\"' + fieldDisplayName + '\"';
var html = o.innerHTML.match(new RegExp(rx)); <--- maybe here?
return html !== null; // && html.length > 0;
});
return theCell;
},
Workaround
Currently I'm working around this by removing the parentheses from the field title.
Proposed Solution
I apologize, but I should mention that I haven't given any thought as to what a solution might look like.
Describe the bug
When a field title contains a pair of parentheses, like
Enter ABC (or DEF), the Fields.hide method does not work.To Reproduce
Steps to reproduce the behavior:
Enter ABC (or DEF).Fields.hide("Enter ABC (or DEF)").Expected behavior
The field should be hidden.
Desktop (please complete the following information):
Additional context
I suspect it's falling down in the getCell method where the title is passed in as a regex pattern for matching, and the parentheses are being interpreted as a regex grouping. (When stepping through the code in the debugger,
htmlcomes back as null on this field.)Workaround
Currently I'm working around this by removing the parentheses from the field title.
Proposed Solution
I apologize, but I should mention that I haven't given any thought as to what a solution might look like.