While it's possible to add more than one view reference field to a webform, only the first field in the form will work. Any field after that will re-use the values of the first field instead of the selected view.
While it's possible to add more than one view reference field to a webform, only the first field in the form will work. Any field after that will re-use the values of the first field instead of the selected view.
Comments
Comment #1
afeldinger commentedFound the problem - the result set is actually retrieved by the "_nodereference_potential_references();" helper function in the Node Reference module.
This helper function saves the results as a static $result array, keyed by a cid generated by the $field['field_name'] argument, which the _webform_viewselect_options() helper function doesn't include.
I've created a quick fix by including a pseudo-fieldname in the $field argument passed to _nodereference_potential_references($field) in the _webform_viewselect_options() function:
However, this is be no means a unique ID. If another webform includes a viewfield using the same view and arguments, it might create a duplicate entry in the static $result array. Of course, the result should be identical, but I'd rather have a true unique ID. Deriving it from a combination of the webform ID, field key and view name and arguments is probably a better way to go.
Comment #2
freakalis commentedThanks, for reporting.
Didn't even send fieldname to _nodereference_potential_references before. Now I make a fieldname by generating a md5 hash out of viewname and args. Should take care of the problem.
Fixed in beta-2 release.