Dynamic Forms On Load

rss

Posted by lucidica - May 13 ’13 at 02:53

I have just been testing with dynamic forms, particularly the 'hide tabs' feature as mentioned in this article

http://formsdesigner.blogspot.co.uk/2013/03/how-to-create-dynamic-forms-with-forms.html

 

The tabs only seem to hide though when the field is changed, how would you get it to hide the tab 'onload' and only show it when the field was changed?

 

  • Dmitry
    Dmitry
    Admin
    Member for: 7 years 4 months 4 days
    #1 by Dmitry May 14 ’13 at 01:06

    In the example above we call 'setResolutionTab' function that shows/hides tab based on Status field value twice: when Status changes and when page is loaded:

    // Subscribe on status change
    fd.field('Status').control().change(function () {
    setResolutionTab();
    });
    
    // Initialize
    setResolutionTab();
    

    So, if you wish to hide tab 'onload' without checking the current field value, just call:

    $('#fd_tabcontrol-0').tabs('option', 'disabled', [1]);
    

    instead of the second call of setResolutionTab after 'Initialize' comment.

  • lucidica
    Member
    Member for: 6 years 5 months 2 days
    #2 by lucidica May 15 ’13 at 04:17

    the function 'setResolutionTab' works fine on the edit form and the new form but not on the display form

     

    If I put in the line you suggested this works fine on the display form (though obviously it disables the tab in all instances)

     

    From what I can see the setResolutionTab function is not being called on load? Maybe I am missing something?

     

     

  • Dmitry
    Dmitry
    Admin
    Member for: 7 years 4 months 4 days
    #3 by Dmitry May 15 ’13 at 12:27

    [#2]: setResoultionTab doesn't work on the display form because it's impossible to get Status field value and compare it with specific values. To make different display forms you don't have to use javascript. Use javascript only if you wish to make the form dynamic, change it while user edits fields. If you wish to design a specific form for specific field values and these values will not be changed on this form you have to use groups:
    http://spform.com/documentation/groups

    With help of groups you can design completely different forms with their specific fields and tabs for the same list and show them in accordance with rules. Rules are built on current field values, current user or date. For display form you have to use rules because values on display form cannot be changed. Please, see our video:
    http://www.youtube.com/watch?v=bI7TFO_bN6c&hd=1

Displaying 1 to 3 of 3 messages