cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to call custom javascript on wizard closing?

Highlighted

Is it possible to call custom javascript on wizard closing?

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.

3 REPLIES 3

Re: Is it possible to call custom javascript on wizard closing?

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>

Re: Is it possible to call custom javascript on wizard closing?

I have used window.onunload achieved the intend. thanks a lot for your response

Re: Is it possible to call custom javascript on wizard closing?

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;
}