Rule to handle content types in new form not working (sp2013)

Forums Classic DFFS Rule to handle content types in new form not working (sp2013)

Viewing 1 reply thread
  • Author
    Posts
    • #9641
      nils.enhoerning
      Participant

      Hi 🙂

      We have been battling, and almost winning the battle, against the issue that the rule to handle content types on new form for lists with multiple content types is not working so well for us.

      We have the following setup:
      List with 2 content types (subsite and sitecollection), on premise sp2013, Oct 25th Production pacakge of SPJS Dynamic forms. We are using the CEWP method, not the jslink, in case that matters.

      Initially we encountered the message that the field was not present in the content type on some of the fields of the “site collection” content type, as it does not have some of the fields the subsite content type. After a lot of trickery we managed to solve this with a custom JS check:

      function getContentTypeName()
      {
      return WPQ2FormCtx.ItemContentTypeName;
      //replace with content type ID if you want to safeguard against renamed content types
      }

      function getContentTypeSubsite(){
      if(getContentTypeName() == “SubSite”){return true;}else{return false;}
      }

      function getContentTypeSiteCollection(){
      if(getContentTypeName() == “SiteCollection”){return true;}else{return false;}
      }

      Then we used rules invoking these 2 methods to hide or show the unique fields, which worked just fine up until a point:

      If we moved the fields which should be hidden/shown based on the content type to another tab than the one loaded when the form loads (i.e. any tab other than the first tab) then the problems returns.

      Has anyone tried to hack it like this and gotten it to work with tabs? 🙂

    • #9655
      Alexander Bautz
      Keymaster

      Hi,
      In general I don’t recommend using content types with DFFS, but of course they are necessary in some cases.

      When this is said, there was an error in getting the content type triggers to work with the latest versions of spjs-utility.js. This means you should be able to use a “normal” DFFS trigger on the “Content type choice” column if you update to the latest version of this file from the DFFS download package

      Depending on how you have set up the form, you might be able to trigger your custom functions on click of the tabs in the form to make it work for all tabs. The reason for this is that a tab is redrawn each time you click it.

      Alexander

Viewing 1 reply thread
  • You must be logged in to reply to this topic.