Easy way to make all fields readonly?

Forums Dynamic Forms for SharePoint Easy way to make all fields readonly?

This topic contains 1 reply, has 2 voices, and was last updated by  Alexander Bautz 8 months, 2 weeks ago.

  • Author
  • #20774

    Keith Hudson

    We are trying to rebuild some lists/forms that were created in another system (not SharePoint). In some cases, the forms have dozens and in a few cases even more than 50 sections, with complex rules for which fields are editable and which are readonly. We would like to be able to create a rule or function that turns all fields on the form readonly unless except for the fields on the tab that matches the current section being worked on. We anticipate using a separate tab for each section of the form, although that may be difficult for forms with over 50 sections.

    A. Is there code we can use to make all fields read only? If so, we could create a rule for each tab on the form that makes all fields read only except for the tab currently being worked.

    B. Any other ideas of how to simplify the creation of these very complex forms?

  • #20799

    Alexander Bautz

    You can loop over all visible fields and set them readonly with this custom js snippet:

    var arrToSetReadonly = [];

    Then you can make the fields in the current tab editable like this:

    var arrToSetEditable = [];

    See what you can do with this example code.

    Regarding QB:
    How many fields do you have in one of these forms? – If you have a large number of fields, your form might be a bit slow to handle – especially if you use an older version of IE. You might want to look into splitting the form into one “mother” and several “children” for example using vLookup.

    Best regards,

You must be logged in to reply to this topic.