Smoo Posted August 5, 2018 Share Posted August 5, 2018 Hi folks. I'm finding our email contact form is truncating messages, whose body is coming from a text area, to 50 characters. Turning off sanitizer for that field removes the problem: //$message = $sanitizer->text($input->post->message); -- truncates $message = $input->post->message; // -- passes full text However I'd still like to have some cleanup performed on user-generated input. Is there a way to set a higher character count for this field? TIA... Link to comment Share on other sites More sharing options...
Zeka Posted August 5, 2018 Share Posted August 5, 2018 https://processwire.com/api/ref/sanitizer/text/ $sanitizer->text($input->post->message, [ 'maxLength' => 0 // no limit ]); But I think that more suitable method in your case is textarea https://processwire.com/api/ref/sanitizer/textarea/ 2 Link to comment Share on other sites More sharing options...
Guy Verville Posted August 5, 2018 Share Posted August 5, 2018 See all the options available here: https://processwire.com/api/variables/sanitizer/ Quote $options that may be provided to the text() and textarea() functions The values given here are the default value when ommitted from the text() function. $options = array( // set to true to allow multiple lines of copy 'multiLine' => false, // maximum allowed characters for multibyte strings 'maxLength' => 255, // maximum number of bytes allowed in the string (multibyte safe) 'maxBytes' => 1024, // strip markup tags 'stripTags' => true, // markup tags that are allowed. Example: "<strong><em>" 'allowableTags' => '', // character to replace newlines with, OR specify boolean TRUE to remove extra lines 'newlineReplacement' => ' ', // character set of $value provided 'inCharset' => 'UTF-8', // character set to convert to (if different from inCharset) 'outCharset' => 'UTF-8' ); 1 Link to comment Share on other sites More sharing options...
Smoo Posted August 5, 2018 Author Share Posted August 5, 2018 Thanks guys - that's exactly what I was looking for. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now