Hi all,

     I am displaying a list of records in a page in my mobile application. I have a drop-down in that page to filter the records in the list. Initially the drop-down value will be nullidentifier().

     While the drop-down value is nullidentifier() I have moved to the bottom of the page (last record of the list). Now the user has selected a value in the drop-down and the records in the list will be filtered. So, now the user has to be sent to the top of the page (first record of the list). 

     To achieve this I have used the following javascript in the onchange action of the drop-down to send the user to top of the page.

"document.getElementById($parameters.WidgetName).scrollIntoView({behavior:'smooth'});"

     But I am getting the following error while using this javascript.




     Can anyone help me fix this issue?


Thanks in advance,

Gowtham


Hi Gowtham,

What value have you passed to your JavaScript's WidgetName input parameter? It should be the Id property of some named widget on screen (I'd say the List's is a good bet)

Hope this helps!

Hi Jorge,

     Thanks for your reply. Please find the attached OML for details.


Solution

Hi Gowtham,

You need to pass the Id of the Widget, if you are to use the GetElementsById method... in your case, your input parameter WidgetName would be pos.Id (no double quotes around it, Id is a runtime property of the pos Widget).

Also, your anchor tag needs to be present on the screen if you want it to scroll into view... if the If condition evaluates to False it won't be and that will throw an extra runtime error. Put it before the If (so it is always part of your screen and not dynamically added and removed depending on the If) and you should be good.

Hope this helps.

By the way, given you are using the GetElementsById you don't need to add an extra "name" attribute (you only need to assign a value to the existing Name property of your element)

Solution