• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

textarea tag - Entering string problem

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No I didn't try it but I will.
Thanks a bunch Frank
Jo
 
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic