EXPLANATION OF edit-doc-file-data PAGE
The edit-doc-file-data form functions as follows.  The api call to a doc-file-form-values endpoint returns an array which is passed into the formFields array.  It includes a field 'Field Type'.  The value of the 'Field Type' is mapped to the 'Field Type' column in doc-file-form-field-routing.csv to determine the behaviour of the field and the associated buttons.  Each row in doc-file-form-field-routing.csv contains the information for making api calls initiated by the buttons, and also the api for populating dropdown lists.  The data in form-field-routing is also used to customise the function of each field on the form.
Each field on the form is either a Document type field or a File type field.  A field will be one or the other but never both and never anything else.  This is defined in the 'ID Type' column of the table.  The purpose of the 'ID Type' is to determine whether to use the documentId parameter name or fileId parameter name when making an api call.  Every api call initiated by one of the field buttons include the ID Type parameter name, either documentId or fileId.  
The next column in the csv table is 'Data Type'.  This determines how the field is managed.  We will return to explain the different Data Types later.  
The next column is 'Name ID Parameter'.  Where this column contains a value, the value is the name of the second parameter which must be passed when an API call is made.  If it is not present in the table then it is not relevant to the API calls.  The 'Name ID Parameter' is the name of the parameter for which the value is stored in formFields as 'Name ID'
The next column is 'Attribute Parameter ID'.  The value in this column is the name of the third parameter which may be sent with API calls where applicable.  The value assigned to this parameter is the ID in the form field which is to be sent to the API.  The 'Attribute Parameter' is the name of the parameter which points to the value in the 'Value' field of formFields.  An API call will require either an Attribute Parameter ID or an Attribute Value, but never both. Which one is required depends on the data type.  
The next column is 'Attribute Value'.  This column is the name of the parameter which contains the value to be sent with an API call where applicable.  For some data types there is no Attribute Parameter ID and only the value is to be sent.    
The next four columns are the routes for API calls.  Create, Update and Delete act on data.  Read reads the data to populate a dropdown list.  
'Create' is the route to the call to create a new field link in the database.  The field on the form is merely a representation of a form template.  There may or may not be a corresponding field record in the database.  The Create function is used to create such a field.  Some fields (Transaction Group, Lock Status, Filename) are permanent, hard-coded in the database and hence the Create api is not relevant.  In those cases there is no entry in the Create column of the table.  All Create API calls require the ID Type parameter of either documentId or fileId plus also the Name ID Parameter, plus also either an Attribute Parameter ID or Attribute Value.  If there is a value in the 'Record Name ID' field of the data then this indicates that there is a record in the database, except where it is not applicable.  The Record Name ID is not applicable for cases where the 'Name ID Parameter' field for the applicable 'Field Type' in doc-file-form-field-routing.csv is empty.  If the 'Create'  column is empty then the field is a type for which the creation of records is not applicable.  For example, for the 'Field Type' of 'Filename', the value can be changed but never created or deleted.  The Filename can only ever be updated.  However for a 'Field Type' of 'File Free Text' for example, a record for a particular Name ID cannot be updated if a record has not already been created.  If a record does not already exist for a 'File Free Text' field then Delete and Update are not applicable.   
The Read column contains the route for the API call to read the contents for a dropdown list.  All of the APIs for Read routes ending in 'read-by-list' require the 'Name ID Parameter'.  All the other APIs for Read routes do not require the 'Name ID Parameter'.  If the Read column is empty then no Read route or dropdown list is applicable for that Field Type.  
The Update column contains the route for the API call to update the contents of the field.  Not all fields require an Update API since only Add or Delete are applicable.  All Field Types for which an Update route is supplied -- except for Document Transaction Group, File Transaction Group and Document Lock Status require all three parameters to be passed to the API: documentId or fileId; 'Name ID Parameter'; 'Attribute Parameter ID'.  The transaction group fields require the Document Id or File ID, plus the Name ID Parameter, which is 'transactionGroup'.  The Document Lock Status Update route only requires the documentId parameter.  
The Delete column contains the API routes for record delete functions.  All of the delete APIs except for 'Document Lock Status' and 'File Transaction Group' and 'Doc Transaction Group' require all three parameters of documentId or fileId; 'Name ID Parameter'; 'Attribute Parameter'.  The 'Document Lock Status' delete API only requires the documentId and the Transaction Group fields only require the documentId or fileId as applicable.  
Now we'll return to the 'Data Type' column.  
A 'Data Type' of 'List' is a dropdown list from which a single element can be selected.  A 'Data Type' of 'MultiSelectList' is a dropdown list from which more than one element can be selected.  All List types have a read API which returns the data for populating the dropdown list.  All of the List Data Types except for the Transaction Group types return an array which includes a field 'Object ID' and another field 'Name', among others. The Transaction Group Data Type read APIs return an array which includes 'Transaction Group ID' and 'Transaction Group Note'.  In both cases the ID must be stored in the background and used as the Attribute Parameter value in API calls.  In the dropdown lists, for all cases the 'Name' value returned by the API is what is to be listed in the dropdown box.   
At 'Data Type' of Text is a free text field; Date is a date; Integer is an integer, Real is a real number; Value is just a text string but is not a free text field.  The field of Value is not editable.  It is like a dropdown list but is not treated the same way. 
Earlier it was mentioned regarding the logic for establishing the absence of a corresponding field record in the database.  Hence if a corresponding field record is not present then all buttons must be disabled until the user interacts with the field.  When the user starts interacting with the field then the 'Add field' button must be enabled, but not the other buttons.  The 'Add field' button then calls the Create API route using the data from the field, either a value that has been entered or the ID of an item selected from a dropdown list, as applicable.  The state of the presence or absence of a corresponding field record in the database is to be stored in the background as an array so that the doc-file-form-values endpoint does not need to be called again.  All these values are to be reset when the doc-file-form-values endpoint is called again when the page is refreshed.  
The 'Delete field' button must be permanently disabled for any 'Field Type' which does not have an entry in the 'Delete' column in doc-file-form-field-routing.csv.  Otherwise it must be enabled whenever the logic is true that there is a corresponding field record in the database, as per the logic mentioned earlier.  Note that the Delete function is not related to deleting the contents of the field but deleting the record that it relates to.  
The 'Save value' button must only be enabled when there is a value in the field AND the logic is true that there is a corresponding field record in the database.  Remember that if a value is entered into a field AND there is no corresponding field record in the database then the applicable button is the 'Add field' button.  
The 'Revert value' button is to revert the value in the field to the original value before the user started interacting with the field.  However this is to reset when an API call is made.  The 'Revert value' button does not make an API call.  

