Hi,
I'm a bit confused, nothing new there then!
I have a form, it populates a SQL DB, on it is a textarea for an address, when filled out and saved to the DB, each newline in the textarea is saved as \r\n (carriage return, linefeed).
ok no porblem, but when the data is displayed back again to the form there is a blank line between each line in the textarea.
WHY?
If hitting enter supplies the DB with \r\n , why when displayed back to the textarea it has a gap between each line, as if it is interpreting \r and \n as two separate commands and so creating the space.
if I save back to the DB, and redisplay there are three blank lines between each line in the textarea , and so on and so on...
How do handle these?
i can't simply change them to \r or \n before displaying on the form, because the backend when the field displays on the DB, it shows each line as pipe separated filed and not display correctly.
and I can't before saving back to the DB change any \r or \n back to \r\n , as if a new line was added in the text area i would have some lines \r and some \r\n , so replacing \r would leave some lines as \r\n\n , which creates two lines in the textarea again.
This must be something simple to handle, can someone advise on the standard way of dealing with this please.
Thanks,
1DMF.
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!
I'm a bit confused, nothing new there then!
I have a form, it populates a SQL DB, on it is a textarea for an address, when filled out and saved to the DB, each newline in the textarea is saved as \r\n (carriage return, linefeed).
ok no porblem, but when the data is displayed back again to the form there is a blank line between each line in the textarea.
WHY?
If hitting enter supplies the DB with \r\n , why when displayed back to the textarea it has a gap between each line, as if it is interpreting \r and \n as two separate commands and so creating the space.
if I save back to the DB, and redisplay there are three blank lines between each line in the textarea , and so on and so on...
How do handle these?
i can't simply change them to \r or \n before displaying on the form, because the backend when the field displays on the DB, it shows each line as pipe separated filed and not display correctly.
and I can't before saving back to the DB change any \r or \n back to \r\n , as if a new line was added in the text area i would have some lines \r and some \r\n , so replacing \r would leave some lines as \r\n\n , which creates two lines in the textarea again.
This must be something simple to handle, can someone advise on the standard way of dealing with this please.
Thanks,
1DMF.
"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!