Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

textarea tag - Entering string problem

 
garfild Baram
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi helper,
I'm using <textarea> tag to insert a query string to use it for a database report.
It works well as long as I dont use Enter key.
Without using Enter key in the textarea I get:
String = "Select * from TableName"
Writing this string in the textarea and using EnterKey I get:
String = "Select *fromTableName"
(I pressed the Enter Key after "*" and after "from".
This query that I get doesnt allow me to create a resultset.
How can I insert spaces after pressing the Enter Key?
Please advise
Thanks
Jo
 
garfild Baram
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I inserted the following routine to replace \n char with apace and it works well.
public static CharSequence removeLineTerminator(CharSequence inputStr) {
String patternStr = "\\n";
String replaceStr = " ";
Pattern pattern = Pattern.compile(patternStr);
Matcher matcher = pattern.matcher(inputStr);
return matcher.replaceAll(replaceStr);
}

Thanks any way
Jo
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There may be a simpler solution. It looks like the textarea processing in the browser is simply removing newlines. Have you checked out the "wrap" options available for the textarea tag? If you haven't, you may find that one of them produces the effect you require, without extra processing.
This bulletin board "post a reply" form I'm typing into uses <textarea wrap='virtual'> for example.
 
garfild Baram
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No I didn't try it but I will.
Thanks a bunch Frank
Jo
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64833
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since this is a client-side issue, I'm moving this to the HTML/Javascript forum for future reference.
bear
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic