2

I'm new to Craft. I've been trying to wrap my head around how to design the concept of Events and Event Registrations. Currently I have both Events and Event Registrations as their own Sections as Channels. An Event Registration has an Entry field to tie it back to an Event. Our admins will create an Event, but we want the public to be able to register for an event via a form. I'm using the guest-entries plugin and am very close to getting this all tied together, but am unsure how to pass the reference to the Event in the form.

I can pass it in via the url http://example.demo/register.html?eventId=99

But what do I reference so that the correct info will be sent to identify the Event entry when the form is submitted?

I assume I can send it via a hidden field, but am not sure what value to send:

    {% set eventId = craft.request.getParam('eventId') %}
    <input type="hidden" name="fields[event]" value="{{ eventId }}">

OR

If anyone sees a better way to design this, I would be open to other ideas.

1 Answer 1

3

So, I found the answer after much digging.

Thanks to this answer https://craftcms.stackexchange.com/a/9831/7962

I see that the entries field type has to be referenced with an additional set of brackets. My form now works after changing my input to:

<input type="hidden" name="fields[event][]" value="{{ eventId }}">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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