Data from multi-line textbox is incomplete when Enter key is pressed

  • Thread starter Thread starter MichaelJohnson168
  • Start date Start date
M

MichaelJohnson168

I am using a multi-line textbox. The problem I am having is that when
the data from that textbox is inserted into the table it is incomplete
if the user presses the 'Enter' key when typing inside it.


For example:

I do not want these items <Enter key pressed>
shipped seperately.


The data field after the text from the textbox is inserted into the
table only has the below:

'I do not want these items'


The 'shipped seperately' is not inserted.


Can anyone inform me on what is going on?


The textbox code is below.

<asp:TextBox ID="AdditionalInfo" runat="server" TextMode="MultiLine">
 
I am using a multi-line textbox. The problem I am having is that when
the data from that textbox is inserted into the table it is incomplete
if the user presses the 'Enter' key when typing inside it.


For example:

I do not want these items <Enter key pressed>
shipped seperately.


The data field after the text from the textbox is inserted into the
table only has the below:

'I do not want these items'


The 'shipped seperately' is not inserted.


Can anyone inform me on what is going on?


The textbox code is below.

<asp:TextBox ID="AdditionalInfo" runat="server" TextMode="MultiLine">

This is a common issue in web applications, as it is normal that enter =
submit.

To circumvent this, you can set up JavaScript that looks for the enter
key and stops it from submitting. The event code you are looking for is
13. Here is a page with an example:
http://www.webcheatsheet.com/javascript/disable_enter_key.php

If you want the enter key to work outside of this box, you can disable
the key only when the user's focus is in the textbox.


--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
I am using a multi-line textbox. The problem I am having is that when
the data from that textbox is inserted into the table it is incomplete
if the user presses the 'Enter' key when typing inside it.


For example:

I do not want these items <Enter key pressed>
shipped seperately.


The data field after the text from the textbox is inserted into the
table only has the below:

'I do not want these items'


The 'shipped seperately' is not inserted.


Can anyone inform me on what is going on?


The textbox code is below.

<asp:TextBox ID="AdditionalInfo" runat="server" TextMode="MultiLine">

That's odd - The multiline should, by default, accept returns like
normals characters and store them as \r\n.
(same as the plain old "textarea" html).

You could try Gregory's solution - it seems, however, quite a
workaround for a situation which shouldn't occur in the first place.

..L.
 
As this is not the usual behavior it is hard to imagine what is wrong :

- make sure this is really missing (the db UI could perhaps foll you by
displaying only the first line of a multiline string). Try a real query to
make sure.
- then double check your data access code... (if this is your own code try
the *MINIMAL* amount of code that does the same thing and have the same
problem : either you'll finally find what is wrong in your approach of
you'll have some SHORT code you can post).

--
Patrice

<[email protected]> a écrit dans le message de groupe de
discussion :
(e-mail address removed)...
 
Back
Top