Post newline/carriage return as hidden field value

Adam picture Adam · Mar 20, 2009 · Viewed 20.2k times · Source

I need to post multi-line data via a hidden field. The data will be viewed in a textarea after post. How can I post a newline/carriage return in the html form?

I've tried \r\n but that just posts the actual "\r\n" data

<input type="hidden" name="multiline_data" value="line one\r\nline two" />

Is there a way to do this?

Answer

orinetz picture orinetz · May 9, 2010

Instead of using

<input type="hidden">

Try using

<textarea style="visibility:hidden;position:absolute;">