Bug 3143 - Weird tab injection in any multiline asp:Textbox embedded within an asp:Table
Summary: Weird tab injection in any multiline asp:Textbox embedded within an asp:Table
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Web (show other bugs)
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2012-01-30 13:46 UTC by guivho
Modified: 2017-06-07 01:27 UTC (History)
10 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description guivho 2012-01-30 13:46:24 UTC
Mono injects two tab characters (i.e. `\t\t`) in front of any text displayed
in multiline text boxes that are embedded as content in an `<asp:TableCell>`
within an `<asp:TableRow>` of an `<asp:Table>`.

Two additional tab characters are injected at every single postback.

This happens with on OS/X Lion 10.7.2 with the Mono Framework 2.10.8.

It can be observed with web applications rendered with xsp4 as well as
with mod-mono-server4, either on Firefox, Safari or Chrome.

Please refer to https://github.com/guivho/WeirdTabs for more details and a little app that demonstrated the problem.

(Note: I'm not sure about the Product and Component categories to choose for this bug)
Comment 1 guivho 2012-01-30 14:57:32 UTC
I have since found one case where this happens even with a multiline textbox that is not embedded in a table. I hope that the above testcase is sufficient to pinpoint and fix the problem, even for this last occurrence too.
Comment 2 pucis 2012-02-05 17:44:50 UTC
I have the same issue.
Multiline texbox works fine on Net2 profile.
Seems like problem is in file:
mcs/class/System.Web/System.Web.UI.WebControls/TextBox.cs line 213

if (TextMode == TextBoxMode.MultiLine) {
#if NET_4_0
  w.WriteLine ();
#endif


I don't know why this WriteLine is there, but this inserts newline before textarea content, and if this textarea is in table then htmltextwriter formats html with tabs and they happen to be in textarea content. (or something like that)
Comment 3 Lex 2012-02-07 00:44:01 UTC
I confirm. 2.10.8 still have this bug. Please fix this.
Comment 4 guivho 2012-04-09 02:44:39 UTC
The problem is still present in version 2.10.9

I understand that this is a minor source update to fix it.

Any particular reason why this annoying thing isn't fixed right away, to be ready for deployment with the next version?
Comment 5 guivho 2012-06-11 12:24:20 UTC
ETA?
Comment 6 AlwaysHC 2012-07-03 04:20:00 UTC
I user this workaround:

<asp:ScriptManager ID="smScriptManager" runat="server">
	<Scripts>
		<asp:ScriptReference Path="../Script/jquery-1.7.2.min.js" />
	</Scripts>
</asp:ScriptManager>
<script type="text/javascript">
	function pageLoad() {
		$(function () {
			$('.Multilinea').val($.trim($('.Multilinea').val()));
		});
	}
</script>
...
<asp:TextBox runat="server" ID="tbTextBoxML" class="Multilinea" TextMode="MultiLine"/>
Comment 7 Cank 2012-08-17 11:43:00 UTC
As pucis@inbox.lv points out, the issue in in TextBox.cs Render. These changes were committed by Marek Habersack 02-July-2010 - quite a while back. It would be best to get this fixed server side. If the changes never worked, then could we please remove them, and revert the file to:


			if (TextMode == TextBoxMode.MultiLine) {

				HttpUtility.HtmlEncode (Text, w);
			}


Thanks.
Comment 8 guivho 2012-08-17 13:45:36 UTC
The current mono environment still has this problem. Please fix this for the next minor release...

mono --version
Mono JIT compiler version 2.10.9 (tarball Mon May  7 20:25:51 EDT 2012)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       normal
	Notification:  kqueue
	Architecture:  x86
	Disabled:      none
	Misc:          debugger softdebug 
	LLVM:          yes(2.9svn-mono)
	GC:            Included Boehm (with typed GC)
Comment 9 Cank 2012-08-17 17:55:58 UTC
Sorry, I forgot to add, the problem persists in 2.11.4, checked out from svn today. I think this is a bug, when the tag is opened Indent count goes up to 1, and newline becomes true. The writeline calls outputtabs, which puts in one tab based on the indent count. When the textarea tag is closed, the tab becomes the default value. We should not be injecting any values into the textbox, this is especially an issue, for admin backends using multiline textboxes, as with every save cycle the textbox value becomes increasingly corrupted. Sure we can apply workarounds but we should fix this in source. I am working in Linux, so I think this is a multiplatform issue.
Comment 10 Don Najd 2013-01-07 03:18:17 UTC
Still happening... jquery workaround that hits all text area tags

// mono tab bug
$("textarea").each(function(){
   this.value = this.value.trim();
});
Comment 11 guivho 2013-01-07 05:16:24 UTC
Well, we're preparing for the first birthday party! :(

This seems to be a well defined and described problem, so please solve this...
Comment 12 Michael Thwaite 2013-02-24 19:35:38 UTC
I'm also experiencing this issue on 2.10.8,9 - causing a few customer complaints.
Comment 13 Michael Thwaite 2013-02-24 19:39:55 UTC
With this code, I'm getting five (5) tab characters - I set it to multi-line in the code:


<asp:Table ID="Table1" runat="server" CellPadding="1" CellSpacing="1">
	<asp:TableRow ID="TableRow1" runat="server">
		<asp:TableCell ID="TableCell1" runat="server">
			<asp:Label ID="Label1" runat="server" Text="" Visible="false"/>
			<asp:TextBox ID="TextBox1" runat="server"/>
Comment 14 Michael Thwaite 2013-02-24 19:50:19 UTC
With this code, I'm getting five (5) tab characters - I set it to multi-line in the code:


<asp:Table ID="Table1" runat="server" CellPadding="1" CellSpacing="1">
	<asp:TableRow ID="TableRow1" runat="server">
		<asp:TableCell ID="TableCell1" runat="server">
			<asp:Label ID="Label1" runat="server" Text="" Visible="false"/>
			<asp:TextBox ID="TextBox1" runat="server"/>
Comment 15 Michael Thwaite 2015-10-30 07:54:56 UTC
What's the status on this, any update - still present.

Note You need to log in before you can comment on or make changes to this bug.