Retaining line breaks when adding task description via PHP API?

Comments

4 comments

  • Official comment
    Casper Fabricius

    Ah yes, that makes sense. Submitting via GET would do that. Why don't you just use POST?

    Comment actions Permalink
  • Casper Fabricius

    Hi Joshua,

    Using regular escaped linebreaks should work just fine. I.e. send "this\nis\nlines" to the API.

    0
    Comment actions Permalink
  • Joshua Hay

    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.

    0
    Comment actions Permalink
  • Joshua Hay

    Because I'm crazy, Casper, because I'm crazy.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk