Retaining line breaks when adding task description via PHP API?
I am using a textarea form field and sending it via GET to a PHP file that adds a task via the API.
I cannot figure out how to get the line breaks in my textarea field to be retained when adding the contents as a description on the task created.
E.g.
"this
is
lines"
becomes
"thisis lines" (or similar)
-
Official comment
Ah yes, that makes sense. Submitting via GET would do that. Why don't you just use POST?
Comment actions -
I know this is probably a weird workaround but what I ended up doing to get it working was to use a javascript function to convert all \n type characters to HTML <br/> tags before sending the textarea contents through as GET variables via AJAX to my PHP script. Then the PHP script replaces all <br/> tags with \n again before submitting to the Podio API. Otherwise, I found that the line breaks were removed completely when submitting textarea.val() via AJAX as GET variables.
Please sign in to leave a comment.
Comments
4 comments