Follow

Multi-Select Form Fields

Background

There is no RFC or other standard for how systems are to structure multi-select form field values in HTTP requests. While the HTML Select element is well-defined, there is nothing in either HTML or HTTP RFCs that address how to format the selected data. It’s the wild west, especially when the request’s Content-Type is application/x-www-form-urlencoded.

The request structure we see most commonly uses multiple name=value parameters, each named for the HTML element:

…&name-item1&name=item2&…

But we’ve also seen formats like:

…&name[0]=item1&name[1]=item2&…

…&name=[item1,item2]&…

Submitting Multi-Select Data to LeadConduit

For application/x-www-form-urlencoded request bodies, LeadConduit recognizes multiple name=value parameters.

String multi-select data can be captured by LeadConduit array-type or string-type flow fields. Numeric multi-select data can be captured by LeadConduit number-type flow fields.

mceclip0.png

Example:

/submit?array1_demo=first&array1_demo=second&reference=ref1&reference=ref2&annual_salary=10000&annual_salary=20000

The instances of each parameter are captured and stored as array/list elements:

mceclip1.png

Setting Acceptance Criteria

Acceptance criteria can be enforced by using an “OR” rule set with the “includes” operator. Also, numeric-type fields can be evaluated using relative-value operators. The above submit string meets all of these acceptance criteria:

mceclip2.png

Outbound Mapping

For outbound mapping of arrays/lists, array-type field elements (not string or numeric type field elements) can be individually mapped by index number.

mceclip3.png

Not specifying an index simply maps multiple instances of the parameter, each with a different index:

Outbound Mappings:

mceclip4.png

Resulting POST parameter string:

Array_All=first&Array_All=second&Array_0=first&Array_1=second&Array_last=first&Array_last=second&Ref_all=ref1&Ref_all=ref2&salary=10000&salary=20000

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

You must be logged in to comment.