2
I would like in my field to allow up to 47 characters in each line, but I have a problem when the user leaves a line and keeps typing. Because it breaks the line before it completes the 47 characters. follows below the code:
 function mascaraCAMPO(campo, e) {         
        var texto = campo.value;         
            if ((texto.length % 47 == 0) && (texto.length != 0)) 
            {               
                campo.value = campo.value + "\n";                    
            }                
        }
 <asp:Textbox ID="txtValue" runat="server" onkeypress="mascaraCAMPO(this,event)" onpaste="return false" ondrop="return false" TextMode="MultiLine" maxlength="4653"    style="resize: none;width:400px" Rows="20" Columns="47"  ></asp:Textbox>
exactly, when the user presses enter.
– Rafael Veloso
But it has the limit of 47 Cars. per line, leaving the line blank does not violate the limit.
– Sam
blank line I disregard in codebehind, the problem is in the count. of length it is only counting the typed characters . For example, if I complete the 47 characters, and type something of 1 character in the bottom line and break the line and type something else it keeps counting and breaks the line as if it were the same line.
– Rafael Veloso
simply don’t let you type more than 47 characters per line if you pass that he plays to the bottom line.
– Rafael Veloso
If you mount an array with the field lines and check at each position of the array, it would not work?
– Augusto Henrique