Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

textarea field ...

Status
Not open for further replies.

zekmek

Programmer
Jun 12, 2003
44
PT
Hi all,

Here is my problem:

i have a textarea in which i display a field from my database. in this field there are '<br>' characters. so i wanted the textarea to go to a new line when he finds a '<br>'. so i told him to each times he finds a '<br>', replace it by '\n'

The problem now is the user can edit this textarea and submit the changes. so i wanted, before the validation, to replace back the '\n' by <br> but it doesn't seems to work. i have also tried to replace the '\r\n' but the same, doesn't work :-(

has anybody got any idea ?

thanks all :)
 
>>>> replace back the '\n' by <br> but it doesn't seems to work

How were you doing this ?
 
for(int i=0;i<packagePriceDetail.length()-3;i++) {
//out.println(packagePriceDetail.substring(1,5));
if(packagePriceDetail.substring(i,i+4).equals(&quot;<br>&quot;))
{
int pos1 = i;
int pos2 = i+4;
packagePriceDetail=packagePriceDetail.substring(0,pos1)+&quot;\n&quot;+packagePriceDetail.substring(pos2);
}
}
 
Code:
This code snippet replaces &quot;<br>&quot; with &quot;\n&quot;.

Didn't you say the problem was with replacing &quot;\n&quot; with &quot;<br>&quot;?   Can we see that code?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top