Java script validation RRS feed

  • Question

  • Hi All,

    I am having a field in which I set the max length as 12 , but the requirement is like it should not accept less than 12 characters also. It should accept only 12 chars.

    Please give me sample code .

    Thanks in advance.

    Friday, May 30, 2014 9:01 AM


  • Hi,

    Use this code to show an notification if less than 12 characters are entered

    var fieldVal = Xrm.Page.getAttribute("your_field_name").getValue();
    if(fieldVal.length < 12)
    	Xrm.Page.getControl("your_field_name").setNotification("Needs to be exact 12 characters");

    Add this code to the onChange of your field.

    Admin QuikView Solution for CRM 2013

    Friday, May 30, 2014 9:27 AM