AXForum  
Вернуться   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 21.06.2013, 01:14   #1  
Blog bot is offline
Blog bot
Участник
 
25,631 / 848 (80) +++++++
Регистрация: 28.10.2006
crminthefield: UR12 improves onchange event behavior of checkbox control
Источник: http://blogs.msdn.com/b/crminthefiel...x-control.aspx
==============

Raise your hand if you've formatted a two-option field on a Dynamics CRM entity form as a checkbox. Keep it raised if you've implemented client-side form logic triggered by changes to that field. Now, start waving your hand wildly if you've overridden the onclick event to invoke your logic immediately rather than wait for control focus to change. If, like me, you're starting to attract attention, keep reading (and please, put your arm down).

Adding client-side event handlers to the onclick event of checkbox controls on entity forms is an unsupported customization that has been perpetrated across many versions of Dynamics CRM. The technique serves as a workaround to the native onchange event behavior of the two-option (Boolean) field when rendered as a checkbox control. Native behavior dictates that handler(s) are not fired until after the control loses focus. This behavior can create an odd user experience when onchange logic should be invoked directly after the user action (i.e. conditionally display/enable a related form control). The only alternative to the unsupported workaround is to render the field as a radio button control which may not provide the desired user experience.

Until recently, I identified this unsupported customization in Code Review reports, but lowered the severity based on risk level and the lack of supported alternatives. That is until I discovered a minor change in Update Rollup 12. As of the UR12 release, the two-option (Boolean) field's onchange event now occurs immediately when formatted as a checkbox control. Say what!?! This is a change that I (and many others) have been advocating for years. Like me, you may have initially overlooked it in the SDK release notes (V5.0.15) because it's only referenced as a general documentation update to the onchange event. Either way, I'll take it. One caveat: the behavior isn't supported by Internet Explorer 7 or 8. For these versions, the control reverts to prior behavior based on focus change.

Don't believe me? Read about it here. Celebrate briefly (quietly). Update CRM to UR12 (or later). Upgrade your browser to IE9 (or later). Finally, clean up your script libraries that register handlers with CRM field onclick events. As for me, gone are the days of sugar coating the severity of this violation in future Code Review reports. No excuses, no exceptions!

Austin Jones

Microsoft Premier Field Engineer





Источник: http://blogs.msdn.com/b/crminthefiel...x-control.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Axilicious:Hosting custom WPF calendar control in AX 2012 Blog bot DAX Blogs 0 20.05.2013 18:11
crminthefield: UR12 vs. Polaris: Commonalities Differences & Improvements Blog bot Dynamics CRM: Blogs 0 05.02.2013 00:12
crminthefield: Script Errors after Installing UR12 Blog bot Dynamics CRM: Blogs 0 21.01.2013 21:11
axinthefield: Dynamics AX Event IDs Blog bot DAX Blogs 0 01.03.2011 22:11
CRM DE LA CREME! Some more useful javascripts for MS CRM Blog bot Dynamics CRM: Blogs 0 04.05.2010 11:05

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 16:47.