0

Desired form submission workflow:

  • User A fills out a form, along with an email address for User B
  • User A submits the form, which then notifies User B by email of a request to complete and approve the form
  • User B clicks a link in the notification email and is able to complete (and approve) User A's submission

User B would actually be adding extra data to the form, not just "approving" it.

What are your ideas for ways to accomplish such a multi-part form? Are there any modules (besides webform) that could assist with this type of form logic? Would you base this on webform, or Drupal 7's forms API?

1 Answer 1

1

All you need is D7 forms API if you are comfortable writing PHP. There are several ways you could go about it. One assumes that the e-mail address of User B is the same e-mail they used to create their Drupal account. You'll need to store the result of User A's submission in a database somehow. Depends if you are already storing data from the DB or not. If not you can use variable_set() to store the e-mail address in one of Drupal's core tables and then variable_get() to retrieve it.

The idea is to save whatever user A stores to the DB after filling out the form. In your form definition, at the top check to see if that value is there. If so, you know user A has completed his part, next step is to check the user accessing this form. If their e-mail address matches the e-mail supplied during user A's part then you display user B's part of the form.

2
  • Thanks for your comment. I should probably have clarified that User B is actually an anonymous user, and not a drupal user, but your logic fits what I was thinking.
    – jwal
    Jun 6, 2011 at 0:57
  • You probably don't want to do that with variable_set()/variable_get() it'd really be abusing that system. You should create a database table—or if you just need something temporary—a cache table.
    – drewish
    Jul 19, 2012 at 19:22

Your Answer

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

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