You are viewing limited content. For full access, please sign in.

Question

Question

Append a table from a table in forms

asked on August 28, 2023 Show version history

Is it possible in Forms 11 (the new designer) to append a table in a form from a table that is being filled out earlier in the form?  I have tried the INDEX(Table.Field,ROW()) and it says its a circular reference.  The user needs to fill in the same information in multiple places of a very long form.  Unfortunately, I wont know how many people are being added to the first table so the other tables have to allow for any number of rows.

0 0

Answer

SELECTED ANSWER
replied on August 29, 2023

We actually just did this.

Use case: On a form for HR/Finance where they need to see both what values (costing information for payroll) are currently set to and what they need to change to, we have a lookup that pulls the existing values into a table. The user then enters the new values into a second table. They needed a button that copies the values from the first table to the second (in the case where the values are not changing, or are only changing slightly).

In Classic designer, we accomplished this with a button that copies the values down to the second table.

In Modern designer, we are using a custom button to write a value to a hidden field, then use that hidden field value in Field Rules in the table cells. So, if hidden field = Yes, then table_cell_B = table_cell_A. We based this solution on this Answers post: 

https://answers.laserfiche.com/questions/210704/Clickable-custom-button-to-showhide-fields-in-Modern-Forms-designer

Here's the code we ended up with:

/* Set adjustable parameters for the form. */
const theFieldId = 48;

/* Listen for messages.  This allows this sandboxed */
/* iframe to receive messages from the form, */
/* so that custom buttons can be used to */
/* trigger this code. */
window.addEventListener('message', function (e) {
  console.log(e.origin);
  /* Handle the specific messages. */
  if(e.data.toString() == 'copy-button-clicked') {
    console.log('button was clicked');
    LFForm.setFieldValues({fieldId: theFieldId}, 'Yes');
  }
});

And here's the HTML we use in the button:

<button style="background-color: #C5BAD0;" onclick="document.getElementById('LFForm_sandbox').contentWindow.postMessage('copy-button-clicked', '*');">Click to Start the Test</button>

When the field value exists, we hide the button and show this "disabled" button in it's place (so the button can only be "clicked" once):

<button disabled="" onclick="document.getElementById('LFForm_sandbox').contentWindow.postMessage('copy-button-clicked', '*');">Click to Start the Test</button>

I hope that helps!

1 0

Replies

replied on August 28, 2023

I think the question is really why do they need to fill out the same data in multiple places? If you capture the data once, you can do things after submission to copy the data over to other tables.

For example, you could have one table to collect the data, then after submission trigger a workflow that takes the table rows and pushes them into the other tables before the next task/step.

 

Something important to remember for web forms is that how you "collect" the data and how you "present" the data don't always have to match. More often than not I make the submission form as user friendly as possible then take all that data and put it in the desired format later.

1 0
replied on August 29, 2023

The reason they are filling it out multiple times is because there are 5 different forms that are redundant in some aspects but all have to be filled out.  Since the information is investigative, different parts can be filled out at different times before the form is actually complete.  This is a Title IX form that consists of several Exhibits where students are listed on multiple exhibits.  It is most likely that majority of these students will be listed in the beginning portions of the forms, however after that, the same students will be used in additional portions of the form.  

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.