• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 735
  • Last Modified:

String with carriage returns causes problems

I am trying to display a String by default into a text area using a JSP directive and it works unless there is a carriage return contained in the String that is returned.

What I am looking for is what character will represent the carriage return to do a substring and break it up into multiple javascript assignments.

For instance:

Now there is:

document.getElementById('coverRow2').innerHTML = "<textarea cols='40' rows='10' name='coverPageContent' id='coverPageContent' onKeyUp='setScreenState(true); wrap'><%=faxCoverBLOB.getCompressedBlobString() %></textarea>";

I think I would need to go with
javascriptString += substring(faxCoverBLOB.getCompressedBlobString(), 0, indexOf('character')) or something like that, but I don't know which character I should search for.
0
neverrealm
Asked:
neverrealm
  • 4
  • 3
1 Solution
 
siliconeagleCommented:
you will also have problems with quotes("):-
faxCoverBLOB.getCompressedBlobString().relpace("\n","\\n").relpace("\"","\\"");
0
 
siliconeagleCommented:
actually
faxCoverBLOB.getCompressedBlobString().relpaceAll("\n","\\n").relpaceAll("\"","\\"");
0
 
neverrealmAuthor Commented:
That's a great idea, but it didn't work.  Also my IDE won't compile the page with the replaceAll("\"", "\\"") portion.  I still get an unterminated string constant with this.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
neverrealmAuthor Commented:
Well, I had to bite the bullet and include the textarea in the main source of the html.  Does anyone have a good way of handling an unchecked checkbox submit?
0
 
siliconeagleCommented:
sorry should be :-
faxCoverBLOB.getCompressedBlobString().relpaceAll("\n","\\\n").relpaceAll("\"","\\\"");
0
 
siliconeagleCommented:
if you have a boolean value for your checkbox:-
<% boolean chkBoxVal=(request.getParameter("chkBoxParam")!=null)?true:false;%>
0
 
neverrealmAuthor Commented:
Actually, I figured it out already, but gave you the answer.  I have a javascript method that actually does the submitting and I can pass additional request paramaters to it and have used that.

Thanks anyhow.  The replaceAll function may come in handy later.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now