IE problem to paste multiple lines of values in Enhanced Search Widget

1409
6
Jump to solution
11-06-2019 10:27 AM
LiangJiang1
New Contributor II

When to copy a multiple lines of value from Notepad or Excel and paste them to to the text box in Enhanced Search Widget, Chrome, Edge and Firefox all can handle it well and work charmingly. However the user prefers IE and IE can only take the first line of values. Any suggestion to fix this? Many thanks. 

0 Kudos
1 Solution

Accepted Solutions
Egge-Jan_Pollé
MVP Regular Contributor

Hi Liang Jiang‌,

You more or less answer the question by posing it. You mention several modern browsers who handle the pasting of multiple lines of value very well.

If the user chooses to stick with good "old" Internet Explorer, he/she should accept the limitations of this application...

HTH,

Egge-Jan

View solution in original post

6 Replies
Egge-Jan_Pollé
MVP Regular Contributor

Hi Liang Jiang‌,

You more or less answer the question by posing it. You mention several modern browsers who handle the pasting of multiple lines of value very well.

If the user chooses to stick with good "old" Internet Explorer, he/she should accept the limitations of this application...

HTH,

Egge-Jan

LiangJiang1
New Contributor II

You are right. Sometime it is better to convince the users to give up IE. 

Egge-Jan_Pollé
MVP Regular Contributor

If you think my answer is right, you might mark it as the correct one 🙂

0 Kudos
LiangJiang1
New Contributor II

I poke around. Brandon Pugh post a solution and code in his blog 

https://www.brandonpugh.com/blog/2011/10/allow-pasting-multiple-lines-in-ie-textbox/
if (window.clipboardData) {
$('#textboxId').bind('paste', function (e) {
var clipped = window.clipboardData.getData('Text');
clipped = clipped.replace(/(\r\n|\n|\r)/gm, " "); //replace newlines with spaces
$(this).val(clipped);
return false; //cancel the pasting event
});
}

Time to digest the Enhanced Search Widget and inject the code above. 

0 Kudos
Egge-Jan_Pollé
MVP Regular Contributor

Hi Liang Jiang‌,

No, I do not agree 🙂 With this code - written ages ago - you do not paste multiple lines in the IE text box. Instead you convert a multi line string in a single line string before pasting it..... And this would only be necessary for IE, because modern browsers do not mind pasting multi line strings. So this would require an additional check, to see what browser is being used.

Again: I would suggest to forget about Internet Explorer altogether 🙂

Egge-Jan

0 Kudos
LiangJiang1
New Contributor II

User likes the convenience to copy multiple rows of parcel number from excel. 

Microsoft should update their IE for the IE lovers. 

0 Kudos