Notifications
Announcements
No record found.
Hi!
I am struggling with the following: I use 'setValue' to change the value of an attribute using javascript. But when I do this the focus is automatically set to the changed field. Is there a way to prevent the system from changing the focus? I want to tab through my form and so this behavior really is getting in my way. Any ideas would be appreciated.
HI,
You can use setfocus client script in JS to focus on control which you want.
docs.microsoft.com/.../setfocus
Add this code at the same place where you are using setValue.
Hi Daniel,
You can achieve it by using setFocus() function to set focus to the field that you need.
1.Js code
function focus(executionContext) { var formContext = executionContext.getFormContext(); var test = formContext.getAttribute("new_test1").getValue(); Xrm.Page.getAttribute("new_test2").setValue(test); formContext.getControl('telephone1').setFocus(); }
2.Test.
When the field(test2) value is set, the phone field is focus in the form.
Regards,
Leah Ju
Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Tom_Gioielli 170 Super User 2025 Season 2
#ManoVerse 70
Jimmy Passeti 50 Most Valuable Professional