CodeIgniter Forums

Full Version: maxlength in texture with newline
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.

Code:
<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,

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