Here’s a little background on my project: I have 10 or so webforms let’s call them Forms A thru J which are for different departments of a college. I also, have 1 credit card processing form let’s call Form Z. I will be collecting information from a form like Form A specific to that departments needs and upon submission will redirect the user to Form Z to process a credit card transaction. I have created a webform handler to redirect the user from Forms A-J to Form Z and a handler to process the credit card transaction. In the redirect handler I am able to pass all of the information from Forms A-J to Form Z using the query string in the URL. I want to avoid this since there would be Personal Identifiable Information (PII) being passed through the URL.
I want to be able to retrieve the data submitted on say Form A from the database when Form Z is loading. I should be able to pass the webform node ID and submission ID to Form Z through the URL query string and use them to get the data from the database. I found these posts which give me an idea of how to retrieve the data from the database:
Programmatically update Webform Submission by sid
Load webform submission
What I can’t find is how do I get this to run when Form Z is loading. I’ve seen a couple of posts on hook_form_alter but those posts are using it in a different way from what I am trying to do so I don’t know it that’s the way I need to go.
Once I retrieve the data from the database I need to populate that data into I’m thinking some hidden webform fields on Form Z. I’d like to be able to fill billing address with the address submitted with the previous form upon request (checkbox or button). Also, I need to be able to have the data from the previous form available once Form Z submits so that I can send a custom email Confirmation depending on which form the information came from (i.e. Form A or B or J).
Being new to drupal development I’ve gotten some great assistance with this project from this site and I am very grateful to those who have been assisting me. 🙂