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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Is it possible to call custom javascript on wizard closing?

anabors-keating
4-Participant

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.

5 REPLIES 5

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.

Announcements

Top Tags