I have a Product channel for eCommerce that members can add entries to for sale on the website.
When a member creates the product, I want the Channel Form to set the value of the "Product Member" relationship field equal to the member who created it.
I am imagining a syntax similar to how I set the URL Title of a Channel Form entry.
<input type="hidden" name="product_member" value="{visitor:global:url_title}" />
Does anyone have any suggestions?
EDIT I found a solution before the answer posted. But Blatant's troubleshooting steps are correct nevertheless. After outputting the field using {field:product_farmer}
, I was able to construct my hidden field to publish the new entry with the currently logged in user.
The end result is this syntax:
I noticed that relationship fields, whether they are one-to-many or many-to-many, use the same syntax (i.e. input type="hidden" name="custom_field_name[data][]" value="{entry_id}"
). Zoo Visitor ID returns the channel entry ID of the currently logged in member.