CodeIgniter Forums
maxlength in texture with newline - Printable Version

+- CodeIgniter Forums (
+-- Forum: Using CodeIgniter (
+--- Forum: General Help (
+--- Thread: maxlength in texture with newline (/showthread.php?tid=65440)

maxlength in texture with newline - rchiu5hk - 06-12-2016

Dear all,

I have below code for inputting text. If text contains new line, it will have problems in controller php. Can input max desc in front end.
But backend it cannot pass max length validation when there is new line. How to also check in front end which also take into consider the new line.

<textarea class="form-control" style="vertical-align: top; horizontal-align: left;
                              resize:none;" id="descriptionTextarea" name="descriptionTextarea" rows="4"  required="true"  maxlength="<?php echo DESCLENGTHINNEWPOST;?>"><?php echo set_value('descriptionTextarea'); ?></textarea>

In the controller,

$content=nl2br(htmlentities($des, ENT_QUOTES, 'UTF-8'));
if(ExceedDescLength($content, DESCLENGTHINNEWPOST)){
      // fall into this