0 Replies Latest reply on Dec 26, 2010 7:20 PM by iefjud874508dS

    Unable to change access mode of fields when they are hidden... help!

    iefjud874508dS Level 1

      Hi Folks,

      I have a work requirement that the user be able to lock/unlock all of the fields on a subform with a checkbox at the beginning of the document.   Beneath this, there are multiple subforms, nested inside dynamic table rows (the user can add/remove rows and subforms).   For each row/subfield, the user can 'hide' some of the fields (show or hide details), to make it easier to view the basic entries.   When some of the fields are hidden, the subform must shrink to just show the basic information

       

      The problem is that I can't get the fields that are 'hidden' to change access mode (locked/unlocked).    So, the user can hide some details, lock the form, but when they unhide the details, the fields that were hidden are NOT locked.

       

      Is there a way to force the access mode on fields to locked/unlocked when they are hidden?    Or is there another way to hide fields and have the space collapse besides setting the presence to 'hidden'?

       

      Thanks in advance!

       

      ====================

       

      I'm using this code to change the access:

       

       

      for (var nPageCount = 0; nPageCount < xfa.host.numPages; nPageCount++) {

      var oFields = xfa.layout.pageContent(nPageCount, "field");

      var nNodesLength = oFields.length;

       

      for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) {

        var sName = oFields.item(nNodeCount).name;

         // this is changed to 'open' for toggling to active

         oFields.item(nNodeCount).access = "readonly";

      }

      }

       

       

      =====================

       

      And I use this code for hiding the fields:

       

       

      if (subForm1.Table1.Row1.Cell2.Subform2.presence == "visible") then

      subForm1.Table1.Row1.Cell2.Subform2.presence = "hidden"

      else

      subForm1.Table1.Row1.Cell2.Subform2.presence = "visible"

      endif