Navigating to a Container in a Form

I’m trying to navigate to a particular container on another form. How can I do this?

For example, I have a Calendar app with each month as a separate form. I want to move to a Container on a form that shows info for a particular day - say April 25

I can go to the form with ChangeForm(April)

But if I use it does nothing. I have tried placing this in the calling button and in the April_onshow event but neither works.

Any help would be appreciated.

I’m still using version 6.1 - have downloaded but not updated to 7 yet.

Does work if you enter it into the Chrome Console?

Thanks for your help.

No. If I enter I get a response of “undefined”

I’ve even tried a button on the April form which executes only which also does nothing.

However in the April_onshow event I set the InnerHtml of ContainerApril25 and it works perfectly???

If is undefined, then it won’t do anything when you execute it.

Do you have such a function in your code?

I thought that the was a built in function that caused the page to move to and display that control.

I have not created a show () function in my code. If I need to what do I put in it to move the page to display the control?

Do I need to create such a function for each control I want to move to? The would be 365 in my case. and Container.hide() will show and hide Container controls respectively.

Is ContainerApril25 a Container control?

What do you get when you type ContainerApril25 into the Console?
It should be something like:

<div id="Container1" class="" style="font-family: inherit; border-width: 1px; 
border-color: rgb(224, 224, 224); display: block;" data-i18n="Content">

Yes ContainerApr25 is a container control this what I see in console when I type in ContainerApr25

but when I type in I just get undefined and it does nothing.

What I’m trying to do is have a Today button on another form that takes the user to the container corresponding to today’s date.

How is ContainerApr25 created?

AppStudio adds .hide() and .show() functions to the Containers it creates.

ContainerApr25 (and ContainerApr1 to 30) are dragged onto the form from the Bootstrap toolbox at design time.
The id=ContainerApr25 at design time. They are then populated at run time by setting the innerHTML property to represent the days of the month and various information about the day.

Does show() just make the container visible - rather then scrolling the page to it?

Is there some other function that can scroll the page to a container?

I found the solution and it’s very easy.

Looks like the container supports the javascipt scrollIntoView function. This is not documented anywhere in NSBasic but it works.

From my menu form I issue the ChangeForm(Apr) command then in the Apr form I issue the ContainerApr25.scrollIIntoView() command … AND IT WORKS!!!

Thanks for your help.

Thanks for posting your solution.

AppStudio exposes the JavaScript environment. Everything which is available there can be used by AppStudio apps. There’s a ton more stuff than we have documented!