Jump to content

Recommended Posts

Posted

I am using sanitizer->textarea to sanitize and format the message inputted. I've tried various options including newlineReplacement but have been unable to convert newlines to <br> tags. Although the PHP nl2br function works as expected. Any suggestions?

Thanks.

Posted

But the text and textarea sanitizers don't allow html tags by default and there is also this comment:

'multiLine' => false, // allow multiple lines? if false, then $newlineReplacement below is applicable

Hopefully this will help show what is happening and what the solutions are. You can either go with the option on line 5 or line 7 although if you go with 5 you might also want to adjust the 'maxLength' option from the default 255 depending on expected content.

image.png.30c854203e938fbac8a7a796f36e4c4b.png

 

  • Like 1
Posted

Thanks Adrian. I went with Option 7. Works well. I guess my mistake was keeping

'multiLine' -> true

assuming it to be a pre-condition to paragraph formatting. 

  • Like 1
  • 3 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...