Webform auto submission reference
Categories
Component ID
Component name
Component type
Maintenance status
Development status
Component security advisory coverage
Component created
Component changed
Component body
This module implements a hidden webform element which automatically discovers and references other webform submissions saved by the current user, anonymous or authenticated.
A typical use case is when there are more then one webforms to get bundled.
For example let's put that a Webform of type A is an application for one product, while webform of type B is a contract which lists all the applications of type A (@see Scenario #1 below).
While this may look like a task to be programmed at the Webform Handlers level, there is an evident part of referencing between Webform Submission entities, and this is what this element needed for. Specifically, it first searches for the configured types of submissions committed by the current user, and then depending on its configuration creates one or more references.
Scenarios
1) Multiple exclusive references: (A1, A2, ..., An) <- B1
When a user starts filling in a form of type B, references to all previous submissions of type A are created.
Element configuration
Multiple: TRUE
Bundles: [A]
Exclusive: TRUE
The exclusive means that any new submission of type B won't get A-submissions already referenced by the previous submissions of type B. In other words, in terms of our example, if you create a new contract, products linked to all previous contracts won't be available.
2) Single exclusive reference: A1 <- B1, A2 <- B2, A3 <- B3
Every new submission of type B will reference "unsued" submission of type A.
Element configuration
Multiple: FALSE
Bundles: [A]
Exclusive: TRUE
Further elaborating on our example, now we create a new contract (B) for each product (A).
3) Single non-exclusive reference: A1 <- B1, A1 <- B2, A1 <- B3
Every new submission of type B will reference the same submission of type A.
Element configuration
Multiple: FALSE
Bundles: [A]
Exclusive: TRUE
Here we just reverse the order of products and contract submissions by first creating a contract and then attaching products to it. But to fulfill the example, we would probably need one more final step with total of products. So let's invent a new webform of type C with two elements - contract and products
Elements configuration
products:
Multiple: TRUE
Bundles: [B]
Exclusive: TRUE
contract:
Multiple: FALSE
Bundles: [A]
Exclusive: TRUE
Usage
In a webform handler we can now easily load our referenced entities.