简体   繁体   中英

CRM Dynamics 2013 loose focus on form field

In CRM Dynamics 2013 I have a scenario where users enter data into fields and then click a ribbon button which then reads those entered values.

My issue is that upon entering the last field, the CRM form field does not loose focus on the field, therefore the value isn't injected, making it null.

This is due to the focus still being on the field, a user would have to click outside the field for it to work. How can I loose focus on the last entered fields?

I tried setting focus on a different field but no luck - is it perhaps possible to using Jquery blur function in CRM JS?

Here is my JS code I tried

Xrm.Page.getControl("new_filename").setFocus(); 

so.. There might be a better solution.. But you can do what you are doing now (use setFocus), and, then, move your main processing into a timer event (start a timer from your javascript, give it 100 milliseconds to fire, and do the rest of processing in your timer function)

Right now "setFocus" does not work for you since it's all on the same thread - it actually does set focus(and moves it out of the last field), but it only happens after you've done your processing

And yes, "onchange" event in CRM, and, hence, all those field changes, only occur when a field loses focus:

https://msdn.microsoft.com/en-us/library/gg334701.aspx

So you do need a workaround there..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM