zaus / forms-3rdparty-integration

Wordpress Plugin - Forms 3rdparty Integration - a plugin to help integrate 3rdparty services with common WP Forms plugins like Contact Form 7 and Gravity Forms
http://wordpress.org/plugins/forms-3rdparty-integration/
47 stars 14 forks source link

Better support for multi-value fields with Gravity Forms and Lasso #87

Closed garretthyder closed 6 years ago

garretthyder commented 7 years ago

Hi @zaus

I just wanted to flag an issue I came across while setting up an integration with Gravity Forms and Lasso CRM following these instructions; http://support.lassocrm.com/hc/en-us/articles/209976413-Integrate-Gravity-Form-with-Lasso

The problem I'm having is with multi-value fields like checkboxes, in the set-up it indicates to map each option as a row in the 3rd party integration plugin. This is slightly different than a Contact Form 7 integration with Lasso CRM as there you create a single mapping for the field rather than each option. CF7 Instructions - http://support.lassocrm.com/hc/en-us/articles/115002860923-Integrate-Contact-7-Form-with-Lasso

In both set-ups you have to specify the separator as either [] or [%].

With the Gravity Forms set-up as you're mapping each option individually if you submit with only one checkbox selected it's sent to Lasso as a single field rather than a multi-field so the field is dropped. If you submit with two checkboxes selected it's sent to Lasso as a multi-field which is handled properly.

For now I've worked around this limitation by adding another row to the mapping which has the 'Is Value' option checked and is mapped to the same question id. This forces the mapping to be multi-value on submission if you only have a single checkbox selected, and since it's empty the empty value is ignored.

My enhancement request would be to either have another column with checkbox for 'Is Multi-value' to force single entries to be seen as multi-entries or somehow detect the incoming field is a checkbox and force the mapping to be a multi-value.

I hope I made sense, it's a bit hard to explain but would be happy to help reproduce.

Thank you P.S. Let me know if you feel this is more a Lasso issue and I can raise with them.

garretthyder commented 6 years ago

Note: I've submitted a request to Lasso so they're aware of the issue and workaround. If they come back with anything worthwhile will update this post.

zaus commented 6 years ago

That's kind of by design, partly because that aspect of the plugin was originally written for CF7 which as you noted handles options differently (I don't really like how GF does options) and partly because it's supposed to be "dumb" in the sense that if you didn't submit multiple values it shouldn't make them multiple values (by that point it doesn't know anything about the original field, just the submission values).

I'm not sure I'd want the overhead of an extra property just to support this edge case; I usually relegate that sort of thing to a hook like ...service_filter_post so "you" can write a plugin -- either hardcode the 'auto-multi' fields or add a simple UI to the service (e.g. an input field so you can comma-separate the submission field keys to 'auto-multi'). Check out my other add-on plugins for examples of how to add settings (particular Xpost or Files Attach).

Reference:

garretthyder commented 6 years ago

Thanks @zaus, greatly appreciate the pointers. I've passed this along to Lasso Support so they can improve their documented integrations. For now, my workaround will suffice, but if a new project requires, I may revisit. All the best