954,566 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Recognising Enter Key

Hi, I'm pretty sure this would be something I'd need javascript for.
What i want to do is to recognize when a user presses the enter key while active on a text area and to insert a new line

ryan-t
Newbie Poster
14 posts since Aug 2010
Reputation Points: 16
Solved Threads: 0
 

What you describe is the natural behaviour in a textarea.

No scripting required.

Airshow

Airshow
WiFi Lounge Lizard
Moderator
2,683 posts since Apr 2009
Reputation Points: 321
Solved Threads: 372
 

That doesn't seem to be what i'm experiencing. could it be the way php interprets the data?

ryan-t
Newbie Poster
14 posts since Aug 2010
Reputation Points: 16
Solved Threads: 0
 

I've done some research into the issue an it sees the be php that isn't following form. But thnks for your help :)

It seems the line breaks were there, but PHP wasn't echoing them. For others with the same problem, nl2br() helped me out

ryan-t
Newbie Poster
14 posts since Aug 2010
Reputation Points: 16
Solved Threads: 0
 

Aha, so the problem was manifest in php not in the browser interface. You didn't say that.

Good old nl2br() to the rescue. Well done, good research.

Airshow

Airshow
WiFi Lounge Lizard
Moderator
2,683 posts since Apr 2009
Reputation Points: 321
Solved Threads: 372
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: