Locking down the data of a repeating subform


1 comment

  • Avatar
    Loren Bratzler

    The only way I can think of to do this would be to put separate entry fields on your main form that match up to the Subform fields and create a button to add the data as a new row in the Subform.  That way you can lock down the subform so that it cannot be edited but still allow new rows to be added to it.

    Here is a quick little example I created:

    The Subform is configured to not allow any edits:


    The button executes a JavaScript function that utilizes the addRowsToSubform method:


    I also added logic to clear out the values in the entry fields after the row is added to the Subform.  Here is the JavaScript I used:


    function addRowToSubform()
       var feedback = getFieldNameObjectValue("FeedbackEntry");
       var decision = getFieldNameObjectValue("ApprovalEntry");

       var options = {};
       options.fieldId = "SubForm1";

       options.value = [{Feedback:feedback,Approval:decision}];

       eFormHelper.addRowsToSubForm(options, function (result)
          if (result.isSuccess)
             console.log(result.data); //logs the data holds the empty object
             console.log(result.error); // logs the hold exception object


    function getFieldNameObjectValue(fieldName)
       var value;
       eFormHelper.getFieldValue({ fieldId: fieldName }, function (result) { value = result.data; });
       return value;

    function setFieldNameObjectValue(fieldName, val)
       eFormHelper.setFieldValue({ fieldId: fieldName, value: val });

    Comment actions Permalink

Please sign in to leave a comment.