0

I've following code snippet at contact form for nickname field of type single line text. I've wired the onKeyPress at onLoad event of the form and tried to debug but every time it throws exception both at on-prem and online environment.

I would like to seek expert opinionon it.

Code Snippet

function onLoad()
{
    Xrm.Page.getControl("nickname").addOnKeyPress(function(){
    alert("Hello World");
    });
}
AQ Dev
  • 43
  • 3
  • 14
  • 2
    Possible duplicate of [Object doesn't support property or method 'addOnKeyPress' in Dynamics CRM 2016](http://stackoverflow.com/questions/36889727/object-doesnt-support-property-or-method-addonkeypress-in-dynamics-crm-2016) – Polshgiant May 03 '16 at 15:30

1 Answers1

0

I am also get same exception message while adding addOnKeyPress event to lookup field. But I tried it for simple text field and its worked. Make sure that you are also applying it for text field or loopup type field.