Textarea Line Breaks

Support MB Builder Textarea Line Breaks

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #39045
    Macky McCormackMacky McCormack
    Participant

    Hey,

    I'm trying to combine some array items to create a text area input with line breaks, but I can't get the line breaks to work. It works with wysisyg but I need the values to be read-only and dont want the large wysiwyg editor on my post edit screen.

    Heres my code:

    
    $address = 
          $this->form_obj['cust_address1'] . 
          '<br>' . 
          $this->form_obj['cust_address2'] . 
          '<br>' .
          $this->form_obj['cust_city'] . 
          '<br>' . 
          $this->form_obj['cust_country'];
    

    Output in admin area:

    https://www.dropbox.com/s/yjv4onkqn89qazn/metaboxtextarea.JPG?dl=0

    Something similar happens with \n (the 'n' prints and there's no line break).

    How do I get a line break in this situation?

    Thanks

    #39068
    PeterPeter
    Moderator

    Hello Macky,

    The field textarea does not save the line breaks to the database, you have to add the HTML tag <br> or newline character \n to display the line breaks on the frontend.

    #39124
    Macky McCormackMacky McCormack
    Participant

    Hi Peter,

    The front end is not the issue, I want to display the info with line breaks on the post edit page.

    Is there a way to do this? Info is read only so doesn't have to use the text area field.

    Thanks

    #39147
    PeterPeter
    Moderator

    I've also searched around on Google but have not found a way to import linebreaks to the database. Please use the HTML tags <br> meanwhile.

    #39167
    Macky McCormackMacky McCormack
    Participant

    Hi Peter,

    Thanks but as I said in the op the <br> tags dont work in this case.

    I'll try and find another solution.

    Cheers,

    Macky

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.