Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X
I would like to know if its possible to call custom javascript when wizard page is getting closed either on the close button or window close? Please help me how to do that?
Thanks in advance.
Austin Nabors-Keating wrote:
I would like to know if its possible to call custom javascript when wizard page is getting closed either on the close button or window close? Please help me how to do that?
Thanks in advance.
Not specifically for close however you can use the afterJS which will call a javascript after a wizard step is complete. From the Windchill help center: "JavaScript function name to invoke on the client side validation for an action window step after the step is completed."
An example of adding this to the ootb defineItemAttributesWizStep action:
<objecttype name="object" class="wt.fc.Persistable">
<action name="defineItemAttributesWizStep" afterVK="setAttributesWizStep" id="defineItemAttributesWizStep" preloadWizardPage="false" required="true" resourceBundle="com.ptc.core.ui.componentRB" afterJS="nameOfMyCustomJavaScriptFunction">
<component name="defineItemAttributesWizStep" typeBased="true" windowType="wizard_step"/>
</action>
</objecttype>
I have used window.onunload achieved the intend. thanks a lot for your response
I'm not sure that afterJS is called if you close the window, to be tested.
If it doesn't work you can try OOTB javascript :
window.onbeforeunload = closingCode;
function closingCode(){
// do something...
return null;
}
Hi, I want to call this OOTB javascript while closing the window. can you tell me exactly where to put this in codebase?
@mcdvoice wrote:
Hi, I want to call this OOTB javascript while closing the window. can you tell me exactly where to put this in codebase?
I have same question and didn't get satisfied solution.