I would like to ask for your opinion in creating a solution for the following application requirements. The general purpose of the application is to administrate students, teachers and courses much like a school administration software.

Some content-types will have related forms (original format is PDF) that are filled in partially by the user and partially by the application. After filling in the required data, the forms must be printable (PDF) and stored for future editing and printing again. The filled form must always stay related to a specific parent node. Means, if the user views or edits the content of a certain node, he needs to see the related forms and be able to click on them to fill in data or edit or print the filled in form again and again.

A small example.

Content-type: student (node)

- related form: attendance 
- related form: enrollment       

Properties of the related forms:

- original forms are available as PDF files
- some fields are filled in programmatically, taking data from the currently viewed student node
- other fields are filled in manually by the user
- filled in forms need to be printable (PDF) or send as mail attachment
- filled in forms need to be stored for future printing / editing 
- forms always need to be related with their parent student node

My targeted solution is as follows using as example the form "attendance":

  1. programmatically create and validate the form "attendance"
  2. store the filled form as a PDF file in the file system
  3. add the PDF as attachment to the related student node
  4. add an edit button beside the attachment that leads the user to the filled form (for editing and printing again)

Could this solution work? Does anybody have ideas or hints for a better solution? Any comments are very appreciated.

1 Answer 1


I would solve this a bit differently:

  1. Programmatically create and validate the form "attendance" - sounds good.
  2. I would create a separate database table and store the filled form data there. It should have node (and user) id fields to determine to which node (user) it is related to. The node id field or node and user id field combination should be unique so you can always get the right attendance data for the specific node/user. Optionally it could have a unique, auto-incremental attendance id as the primary key if more than one field would be needed otherwise (easier to create unique paths for every attendance). Then I'd also add either separate fields for every form field or one field for all the data (serialized) depending of the needs.
  3. Add a link instead to a programmatically created path (example: attendance/1/pdf where 1 would be the unique id for the attendance). When the user goes to the page create the pdf from the attendance data that they can download/view.
  4. Add a link to the attendance edit form page (example path: attendance/1/edit).

One more thing to note is to get the (view/edit) permissions right if there is a need for restrictions.

In case my solution idea doesn't fit too well with all the specific requirements I would just say that you should store data in the database not files.

  • Thank you very much Dooshta for your suggestions. I'll do it this way. Storing the filled form data in a database table makes things much more flexible and integrates better with my custom access control module. Great hints! Just one more question: how would you create the pdf form from the database data? Maybe with tcpdf? Again, thank you very much for your help.
    – jbiechele
    Commented Feb 7, 2012 at 9:09
  • I haven't personally implemented pdf creation on Drupal sites this far, but I've worked with a couple of projects where this functionality was handled with the help of tcpdf. So yeah, it should be a good/safe pick here.
    – Madis
    Commented Feb 7, 2012 at 10:30
  • Thanks again for your very helpful comments. Once I have solved the PDF part I'll report back the taken solution.
    – jbiechele
    Commented Feb 7, 2012 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.