navigateTo()

Previous Next

Syntax

 navigateTo (targetPage, applyChanges, quiet)

 

Parameter(s)

targetPage [String]

applyChanges [Boolean, Optional: true]

quiet [Boolean, Optional: true]

 

Description

Navigates to another page, and pushes this page to the top of the page stack. Pages are popped from the page stack by the function closePage() or cancelWindow().

 

The applyChanges attribute executes a checkData(), not a commit. The navigation will not be executed if checkData() fails.

 

The quiet attribute suppresses information messages of the checkdata() call, error messages are always displayed.

 

Any script written after a navigateTo() call is executed in the context of the new page. This is possible because the script parts after such a call are sent along with the page that is navigated to. For example, the script:

 navigateTo("Employees");

 setSearchValue("EMP", "EMP_NAME", "J%");

 executeQuery("EMP");

shows a navigation to the EMP page which will then query and display all employees whose name begins with 'J'.

 
Note that only inline script and script executed through the callClient() script function is processed by the USoft internal parser. If the script is defined in an external file all code placed after a navigateTo/navigateRelated/navigateLookup call is lost unless it is embedded in a callClientScript() function.

 

Example: deleting an employee by clicking a button

This example shows the correct usage of callClientscript() and navigateTo() in JavaScript defined in an external file.

External file: c:\temp\test.js

Contents:

function deleteEmp(search_name)

{

 callClientScript(navigateTo('Employees');setSearchValue("EMP","NAME", search_name); executeQuery();deleteRecord();closePage())

 alert('employee ' + search_name  + ' is deleted, you still need to commit')

}

 

Button script file property: c:\temp\test.js

Button script property (inline script): deleteEmp ('JAN')

Result: click the button, employee JAN is deleted, and you will see the message box. It will appear as long as you stay on the current page because all page navigation is performed in the background.

 

Related functions: navigateToLookup(), navigateToRelated(), checkData(), closePage()