Skip to main content
14-Alexandrite
July 2, 2015
Solved

Does anyone know how to make "No Content" default for some wtDocuments, and have a template automatically selected for others?

  • July 2, 2015
  • 3 replies
  • 2005 views

We have a number of wtDocuments that require "No Content" & others that require a template to be selected. Our users continually make the mistake of not selecting the template, and complain why we can't make "No Content" as a default for documents.

Best answer by tgudobba

Looks like I was able to do this by modifying the documentManagement.js file.

3 replies

ShirishMorkhade
16-Pearl
July 5, 2015

Hello Tim,

I believe I have done this before. Let me go through my archived emails and I will share steps with you.

Thanks,

Shirish

ShirishMorkhade
16-Pearl
July 6, 2015

Hi Tim,

Wanted to confirm which Windchill release & datecode you are using so I can validate the steps for this perticular release.

Additionally are you also looking for a way to hide "Local File" option from drop down list?

Best Regards,

Shirish

tgudobba14-AlexandriteAuthorAnswer
14-Alexandrite
July 7, 2015

Looks like I was able to do this by modifying the documentManagement.js file.

ShirishMorkhade
16-Pearl
July 8, 2015

Hi Tim,

You can also achieve this using JavaScript. For an example, you can below JavaScript function in "<WT_HOME>\codebase\netmarkets\jsp\document\create.jspf":

<script language="JavaScript">

     PTC.driverAttributes.on("afterRefresh",function() {

          setTimeout(function(){ customPrimaryContent(); }, 100);

     });

     function customPrimaryContent(){

          var element = document.getElementById("createType").value;

          var desiredDoc = "wt.doc.WTDocument";

          var list = document.getElementsByName('___primary0contentSourceList___combobox');

          var fileInput = document.getElementById("primaryFileWidgets");

          if(element.toLowerCase() === desiredDoc.toLowerCase()) {

               list[0].selectedIndex = 0;

               fileInput.style.display = "none";

          } else {

               list[0].selectedIndex = 1;

               fileInput.style.display = "initial";

          }

     }

</script>

By doing this I am able to make "No Content" to Document type. See below:

Thanks,

Shirish

Document Type.png