2

I have two sections:

  • Drinks
  • Ingredients

I have a relation/entry field set on the drinks. So for example, two entries in the ingredients section are related to a specific drink.

My question:

I have a guest entries form, which submits new ingredients and I want to relate this (or these..) ingredient(s) to the current drink. How would I go about doing this?

Creating the ingredient itself is not the problem. The problem is relating it to the drink.

For example, is there a hidden input where I can pass along a new array?

Thanks in advance,

Steve

1

You'd use this syntax:

<input type="hidden" name="fields[fieldHandle][]" value="123" />

Note the value should be the ID of the entry you want related. There's a handy guide here for the front-end syntax for all of Craft's field types: https://straightupcraft.com/articles/craft-cms-field-guide-twig?view=input

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.