Different form for different view.

Forums Dynamic Forms for SharePoint Different form for different view.

Tagged: 

Viewing 7 reply threads
  • Author
    Posts
    • #35189
      Harsh
      Participant

      Hello,
      We have task to convert SP10 on premise InfoPath form to DFFS.
      In info path there is different form as per views for single list.

      Please see attached image, there is different view for single list in info path form.

      How can i achieve this functionality in DFFs?

      Attachments:
    • #35194
      Alexander Bautz
      Keymaster

      Hi,
      I’m not sure I understand – what is in these views? – is it different NewForms (different set of fields shown)?

      If so you can for example set up different tabs matching the different “views” and initially only show a select where they select the view they want to use. In your DFFS form you set up a rule to trigger for each of the options – showing the correct tab.

      Please note that you must check the “No reversion of this rule” if you set up multiple rules on the same field (one for each view to show).

      Alexander

    • #35195
      Harsh
      Participant

      In info path forms there is option for design forms for different views.
      check attached image (view in info path)

      in the new form, there is rule set and it is switch for according to two button in form.
      check attached image (switch condition)

      For example, when user click on ‘Add shared service initiative’, form switch to shared service view from the default view.

      My question is how can i achieve this in DFFS, how do i set rules for this?
      Is there any option for diffrent views in DFFs?

    • #35201
      SteveE
      Participant

      I think when you say “view” it’s the confusing part (to me at least).

      If you are saying the form changes when you click a button, this can easily be accomplished by creating a toggle and based on if it is set to “Yes/On” the form can make a new tab or section appear.

      If you are saying that based on a list view that you are starting from, when you enter a new item (or then access it in the future) the form will display differently, I have code that will find the view source and alter the form.

    • #35210
      Harsh
      Participant

      Yes,
      I want to switch form design on toggle/two buttons.

      I have created two tabs, Tab0 and Tab1.
      When toggle is set as Yes/true, i want to display Tab0 and for no/false i want to display Tab1.

      How can i achieve this?
      Do i need to write code in custom js?
      Please provide code which is use for switch between two tabs.

      Thanks in advance.

    • #35214
      SteveE
      Participant

      Native DFFS will do this without additional coding.

      Create a rule and set the trigger to if the toggle is equal to checked. Validate on form load and field change.

      Scroll down and under Visible tabs enter the uniqueID (Tab0) of the tab you want to show when it’s checked. Also under the Hidden tabs you can enter the uniqueID (Tab1) of the tab you want to hide when it’s unchecked.

      That’s why DFFS is so nice – a simple rule can do a lot!

      • This reply was modified 1 week, 5 days ago by SteveE.
    • #35226
      Harsh
      Participant

      Thanks, @SteveE
      You understand describe perfectly, cheers for you….!

      I get the point of switching tab on toggle,

      Now i wanted to switch tab bases on list view,
      For example i have two custom views in list,
      So total views in list,
      1. All items
      2. View1
      3. View2

      Now, when user select View1 in list and click on Add Items, DFFS form with Tab0 design should display, and for View2 form with Tab1 should display.

      How can i achieve this?

    • #35233
      Alexander Bautz
      Keymaster

      Add these two functions to your Custom JS:

      function getIsFromView1(){
          var sourceView = document.referrer.split("/").pop();
          if(sourceView.indexOf("View1.aspx") === 0){
              return true;
          }
          return false;
      }
      
      function getIsFromView2(){
          var sourceView = document.referrer.split("/").pop();
          if(sourceView.indexOf("View2.aspx") === 0){
              return true;
          }
          return false;
      }

      Now set up two rules using the trigger “Custom JavaScript function” where you add getIsFromView1 to the “This value” field in the first rule and getIsFromView2 in the same field in the second rule.

      In the “Visible tabs” you put the name of the tab to show and in the “Hidden tabs” you add *.

      Let me know how this works out.

      Alexander

Viewing 7 reply threads
  • You must be logged in to reply to this topic.