Closed twomice closed 4 years ago
@twomice Potentially quite straightforward. We just call the attachment API to actually upload the signature - and the "configuration" for that is done via webform fields (for custom field ID + activity type ID) with specific keys. It would be nice to improve that "configuration" and do it some other way. But to support two e-signatures (assuming the underlying esignature plugin supports multiple) you could just add a loop to the code which creates the attachments and append _1, _2 etc to the webform elements which are used for configuration.
I think I understand. So a site builder would need to create one additional hidden webform field, esign_custom_field_2, and the module code, finding that additional field, would display an additional esign widget. Is that right? (Or would they also need to create a second esign webform field as well?)
Also, slightly tangential, but if we're having multiple esign fields on a form, do we need to consider the possibility that the webform could be configured for multiple activities of the same type -- and in that case, the possibility that we want one esignature on one activity, and the second esignature on the other activity?
You'd need an additional esign widget too - and then enough hidden webform fields to describe the required configuration
@mattwire Sorry just getting back to this. Thanks for answer. Any thought on this part?
if we're having multiple esign fields on a form, do we need to consider the possibility that the webform could be configured for multiple activities of the same type -- and in that case, the possibility that we want one esignature on one activity, and the second esignature on the other activity?
@twomice Yes, that should be pretty easy to resolve. It's just a case of collecting the right info and doing something logical with it when processing.
Hi @mattwire . We've got a working solution (pretty close to a PR) which supports use cases like the following:
Different to what we discussed above, our approach was -- instead of making the user create additional hidden webform components -- we accept comma-separate values in the two existing hidden fields. Example configurations are like so:
Use case | esign_custom_field example |
esign_activity_type_id example |
notes |
---|---|---|---|
A single custom field on a single activity | custom_9 | 70 | (same as current behavior) |
A single custom field on multiple activities (must be different types) | custom_9,custom_9 | 70,71 | |
Two custom fields on a single activity | custom_9,custom_10 | 70,70 | Note that the same activity_type_id is given twice |
Different custom fields on different activities (different types) | custom_9,custom_10 | 70,71 |
Things I like about comma-separated vs a fieldname
_N convention:
fieldname
and fieldname_1
; of course in the fieldname
_N convention, both should have the same meaning, but explaining that is tedious.Are you interested in a PR along these lines?
@twomice That seems sensible!
Closed via #5
Hi @mattwire I've got a use case for having two e-signatures, linked to separate custom fields on a single activity, on a single webform. Any thoughts on what it would take to make that possible?