In crm 2011, the input field identifier is the attribute name, while in crm 2013 the input field identifier is the attribute name plus "_i" (maybe "i" means input).
So, if we have the attribute name "name", then the input field identifier for this attribute in 2011 is "name", and in 2013 it is "name_i".
The following is a representation of the source of an attribute input field in a form in crm 2011 and crm 2013.
Input field in crm 2011
<input id="name" tabindex="1010" class="ms-crm-Input ms-crm-Text" style="-ms-ime-mode: auto;" type="text" maxlength="255" value="test" attrformat="text" attrpriv="7" attrname="name" req="2">
Input field in crm 2013
<input id="name_i" title="" class="ms-crm-InlineInput" aria-labelledby="name_c name_w" style="-ms-ime-mode: active;" type="text" maxlength="160" attrname="name" attrpriv="7" controlmode="normal" defaultvalue="Blue Yonder Airlines (sample)">
If you apply disguise in crm 2011, please see here ! or just use the following code.
//Include jquery and jqueryMask plugin file on form you apply masking. function Mask(field, format) { $("#"+field).mask(format); } // call this function on form load event function maskFields() { Mask("address1_postalcode", "99999-9999"); Mask("telephone1", "(999) 999-9999"); Mask("telephone2", "(999) 999-9999"); Mask("fax", "(999) 999-9999"); }
For crm 2013 you should attach "_i" with the field name.
function Mask(field, format) { $("#"+field+"_i").mask(format); }
But also does not work, because in crm 2013 input fields are created at runtime. you must apply masking on an input event on input, or you just got the attribute focus before applying masking, for example.
//Include jquery and jqueryMask plugin file on form you apply masking. function Mask(field, format) { //first check whether attribute exist or not var oCtrl = Xrm.Page.getControl(field); if (oCtrl != null) { oCtrl.setFocus(true); $("#" + field + "_i").mask(format); } } // call this function on form load event function maskFields() { Mask("address1_postalcode", "99999-9999"); Mask("telephone1", "(999) 999-9999"); Mask("telephone2", "(999) 999-9999"); Mask("fax", "(999) 999-9999"); }
Worked well for crm 2013.