Basic Customization > User Interface Customization > Gathering the Data for the UI > File Download > Solution > Solution Elements
  
Solution Elements
Element
Type
Description
main.js
JavaScript
This file includes the JavaScript fragment util.jsf, which defines the PTC.util.downloadUrl(url) function. It is located in //codebase/netmarkets/javascript/util
<MyScript.js> or <MyScriptPart.jsfrag>
JavaScript (whole or fragment)
Code a call to PTC.util.downloadUrl(url) directly in JavaScript or inside a <script> tag in JSP.
<MyPage.jsp> or <MyPagePart.jspf>
JSP (whole or fragment)
<MyWizardFormProcessor.java>
Java class
Use a FormResult object to pass JavaScript to the client for execution. The general pattern is:
formResult.setStatus(FormProcessingStatus.SUCCESS); // or prior value
formResult.setJavascript(js); // where js is a string of JavaScript code
formResult.setNextAction(FormResultAction.JAVASCRIPT); The JavaScript string should include a call to PTC.util.downloadUrl(url); it may also contain other necessary code. If handling the OK button click in a wizard, you should run the download in the opening window:
window.opener.PTC.util.downloadUrl(theURL);
and close the wizard:
window.close();