web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Control focus (Calculator for Unit form)

(0) ShareShare
ReportReport
Posted on by 6,603

Hello:

We've made a minor modification to the flow of the UnitOfMeasureCalculator form where based on item specifics the UOM fields are filled in automatically which then in turn enables the to and from value fields. The additional requirement is to put the focus on the from text field but there must be some additional code / configuration in place that forces the focus to the from UOM control. When the form runs I can see the focus set to the value field for a split second then jumps to the from UOM control. Does anyone know where the focus is set to the UOM control and how can it be overridden?

Thank you very much!

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Ivan (Vanya) Kashperuk Profile Picture
    on at
    RE: Control focus (Calculator for Unit form)

    Where are you making your changes?

    I assume they are in the UnitOfMeasureCalculator class? modifiedProductControl method?

    It seems to work just fine for me, if I make such changes there

  • bankk Profile Picture
    6,603 on at
    RE: Control focus (Calculator for Unit form)

    Hi Ivan,

    Yes, I begun there and called setFocus() there initially. It didn't work for me however. Later I realized it probably would make more sense to have the change in setValueControlsEnabled as the text controls are enabled there. Didn't work there either.

    Question for you. When you're running the form as it initially comes up, the text fields for to and from are greyed out, correct? It's only after you select the UOMs are the fields editable. Once they not greyed out then i'm able to call setFocus() with no issue. However, the code changes I made would automatically fill the UOMs after the item is selected. Problem is the focus jumps to the from UOM rather than the from text field.

    Thanks.

  • Suggested answer
    Ivan (Vanya) Kashperuk Profile Picture
    on at
    RE: Control focus (Calculator for Unit form)

    Yes, they are greyed out by default.

    What I did for testing your scenario is modify the setValueControlsEnabled method, saying that both From and To value controls should be enabled if the product has been selected (I did not bother with getting some default UOMs assigned - I assume that's your case). After than I setFocus() on FromValueControl.

    Works just fine. give it a try - if that works - the problem is with your code that sets the From and To UOM

  • bankk Profile Picture
    6,603 on at
    RE: Control focus (Calculator for Unit form)

    Hi Ivan,

    May I ask one more question? When you select an item are you typing in the item Id or selecting from the drop down / lookup? I may have failed to mention it works fine if I use the drop down but if I type in the item Id the setFocus does not work. I would see a quick flash on the value field before it focus jumps to the UOM field.

    Thank you!

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.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#2
Guy Terry Profile Picture

Guy Terry 2 Moderator

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans