I have a read-only textbox on a form that is populated with the number of rows in a table. When I submit the form, it sends an email and creates a PDF from the form fields. However, the textbox that holds the number of rows is empty in the PDF. Is there a setting that I'm missing, or could it be something in the process?
Question
Question
Answer
If they are all text, then I would do the following:
- Add a 5th column with a Number type
- Under functions, set it's value to =ROW()
- Change the COUNT function to reference that new column
- Switch to the Field Rules tab
- Set HIDE (the number column) ALWAYS
Now that column will give you want you need to count the rows, it will be invisible to the user, and you won't have to deal with the workarounds associated with changing read-only field values via JavaScript.
Replies
What are you using to populate the field? If you're using JavaScript, then Forms will not retain the updated value because the field is read-only.
If that is the case, there's actually an easier way. Use a Function instead. Go into the advanced tab for your row count field and use the following function
=COUNT(Table.Column)
Replace "Table.Column" with any of the columns for your table. Functions will auto-update, and they will be saved even if the field is read-only because it is an "internal" process.
This is a dynamic table that can have rows added and removed, not sure that makes a difference. The textbox doesn't update as I add or remove rows, it just shows 0 the whole time. The PDF still shows 0 for the total when I submit the form. I did have javascript modifying the value automatically, but I've commented that out for now. I also have an Approval form that does have the correct number of rows in the textbox.
What is the exact function you put in? It still works with dynamic tables (I've used this approach many times).
You have to fill =COUNT() with a column variable from your table.
=COUNT(Household_Member.Name)
I think I figured it out, it is not counting text fields, but I have other solutions. Do you now how to create a hidden column in your table?
There are four columns, and none of them are required.
If they are all text, then I would do the following:
- Add a 5th column with a Number type
- Under functions, set it's value to =ROW()
- Change the COUNT function to reference that new column
- Switch to the Field Rules tab
- Set HIDE (the number column) ALWAYS
Now that column will give you want you need to count the rows, it will be invisible to the user, and you won't have to deal with the workarounds associated with changing read-only field values via JavaScript.
Yep, that works! Thank you again!