locked
What's the equivalent of an "attachevent" of CRM 4 within CRM 2011 ? RRS feed

  • Question

  • I have seen that "attachevent" is not supported anymore within a javascript web resource  of CRM 2011.

    How can we attach event handler to javascript events (like onblur etc...) in a CRM 2011 javascript library ?

    Many thanks in advance,


    Bianca
    Thursday, May 19, 2011 2:13 PM

Answers

  • I don't know that it was ever really supported for events other than the onchange, onsave and onload.  The fact is that the new Xrm.page model is a derived model from your usual page constructs from the crmForm.all days that vastly improves security in terms of what people can do with customizations that deal with style and whatnot, since none of those types of customizations are supported.

    If you were in the habit of using styles and doing other types customizations clientside that are out of the norm you will have a hard time figuring these out in 2011. 

    The fact is that an update rollup or upgrade could break your CRM implementation if you are allowed to do these types of customizations.  It also creates unpredictable results in terms of functionality that Microsoft will not provide support for.


    Jamie Miley
    http://mileyja.blogspot.com
    Linked-In Profile
    Follow Me on Twitter!
    Thursday, May 19, 2011 2:37 PM
    Moderator
  • This may be too late to help the original poster, but you can still do this using legacy code.

    crmForm.all.field.attachEvent("onkeydown", fxn); 

    still works. I use this to restrict keys i don't want in some fields (ie, credit card numbers, zip codes, etc).

    I am investigating accomplishing this using Xrm.Page and will try to remember to come back here and update this thread when i get it working. ;)

    Wednesday, June 8, 2011 10:11 PM

All replies

  • I don't know that it was ever really supported for events other than the onchange, onsave and onload.  The fact is that the new Xrm.page model is a derived model from your usual page constructs from the crmForm.all days that vastly improves security in terms of what people can do with customizations that deal with style and whatnot, since none of those types of customizations are supported.

    If you were in the habit of using styles and doing other types customizations clientside that are out of the norm you will have a hard time figuring these out in 2011. 

    The fact is that an update rollup or upgrade could break your CRM implementation if you are allowed to do these types of customizations.  It also creates unpredictable results in terms of functionality that Microsoft will not provide support for.


    Jamie Miley
    http://mileyja.blogspot.com
    Linked-In Profile
    Follow Me on Twitter!
    Thursday, May 19, 2011 2:37 PM
    Moderator
  • This may be too late to help the original poster, but you can still do this using legacy code.

    crmForm.all.field.attachEvent("onkeydown", fxn); 

    still works. I use this to restrict keys i don't want in some fields (ie, credit card numbers, zip codes, etc).

    I am investigating accomplishing this using Xrm.Page and will try to remember to come back here and update this thread when i get it working. ;)

    Wednesday, June 8, 2011 10:11 PM
  • This may be too late to help the original poster, but you can still do this using legacy code.

    crmForm.all.field.attachEvent("onkeydown", fxn); 

    still works. I use this to restrict keys i don't want in some fields (ie, credit card numbers, zip codes, etc).

    I am investigating accomplishing this using Xrm.Page and will try to remember to come back here and update this thread when i get it working. ;)

    From searching the CRM 2011 SDK:  attachEvent

    window.attachEvent("onresize", function () { SDK.UISamples.updateViewPortSize(viewPortDisplay); });
    • Edited by Pvt. Stash Friday, October 14, 2011 4:33 PM
    Friday, October 14, 2011 4:32 PM
  • Wednesday, March 7, 2012 3:48 PM
    Moderator