Search This Blog

Tuesday, October 4, 2016

Character or Word Count for Multi line Text box in SharePoint List Forms

Character Count for Multi line text box in SharePoint New,Edit List Forms.

Step 1 : Open your List new/edit form using SP Designer.

Step 2: Add <span> tag under your multi line text filed description in the New form.

<span title="4000" id="commentscount">4000</span><span> Characters Left</span>













Step 3: Add the below code in your New form. and download jquery latest file.

<script type="text/javascript" src="../../Style Library/Scripts/jquery-3.0.0.min.js"></script>
<script type="text/javascript">

$(document).ready(function() 
{
//character count
$("textarea[name*='ff43']").keyup(function () {
characterCount('ff43', '#commentscount');
});
function characterCount(controlID,spanId)
{
 var controlVal = $("textarea[name*='" + controlID + "']");
 var cmax = $(spanId).attr("title");
 if(controlVal.val().length >= cmax) {
     controlVal.val(controlVal.val().substr(0, cmax));
  }
 $(spanId).text(cmax - controlVal.val().length);            
}

 }); 
 
 </script>

Step 4: Save the form and refresh your page.









Happy Coding!.

No comments:

Post a Comment