locked
Dynamics CRM 2015 : On KeyPress event RRS feed

  • Question

  • Dear all,

    I have the following situations:

    1.  Convert text to Upper Character as and when a text box is being filled

    2.  Allow recording of only numbers in a TextField.

    Can anyone help/guide me how to achieve this.

    Any help would be greatly appreciated.

    Many thanks & Regards

    Vinay

    Monday, August 17, 2015 10:24 AM

All replies

  • Hello,

    1. Add following function to onchange event handler of your field:

    function onFieldChange(){
    var fieldname = "Put field schema name here";
    
    var fieldvalue = Xrm.Page.getAttribute(fieldname).getValue();
    
    if (fieldvalue != null){
    Xrm.Page.getAttribute(fieldname).setValue(fieldvalue.toUpperCase());
    }
    }

    2. Add following function to onchange event handler of your field:

    function onFieldChange(){
    var fieldname = "Put field schema name here";
    
    var fieldvalue = Xrm.Page.getAttribute(fieldname).getValue();
    
    if (fieldvalue != null){
    Xrm.Page.getAttribute(fieldname).setValue(fieldvalue.replace(/\D+/g, ''));
    }
    }


    Dynamics CRM MVP
    My blog

    Monday, August 17, 2015 11:33 AM
    Moderator