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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Scroll to control location javascript

(0) ShareShare
ReportReport
Posted on by

Hello

I have a web resource on top of my form. My form is quite long and has a lot of fields as a result we have a scroll bar. When my users are at the bottom of the page (the web resource im interested in is now on top and out of view hidden by the scrollbar). I want to be able to jump to this web resources location on the form. I tired the setFocus command and while it does select the web resource, it does not move the scroll bar all the way up to the top and bring the web resource into view. I need to be able to jump from bottom scroll all the way to the top using java script. Is this possible and if yes can you please show me how i can achieve this?

Thanks

*This post is locked for comments

I have the same question (0)
  • Verified answer
    ashlega Profile Picture
    34,477 on at

    Hi,

     I would try to combine getControl("..").getObject() (Xrm method) and scrollIntoView (Html method):

    www.w3schools.com/.../met_element_scrollintoview.asp

    msdn.microsoft.com/.../gg334266.aspx

     Might probably look like this:

     Xrm.Page.getControl("<NAME>").getObject().scrollIntoView();

  • Community Member Profile Picture
    on at

    interesting. it works but the padding of the page messes up as shown in the image. do you know anyway that does not mess up the padding on the sides? as you can see the G in general is starting to get cut off. its the same for all titles on the form.

    messedupPadding.PNG

  • ashlega Profile Picture
    34,477 on at

    No idea really.. it seems that it sort of "over scrolls".. maybe you can scroll it a few pixels to the left after that, but it's just guessing

    www.w3schools.com/.../met_win_scrollby.asp

    (would be some negative number for the first parameter there)

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans