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

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">
 
G

Gregory A. Beamer

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.
 
L

Leon

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.
 
P

Patrice

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)...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top