I'm attempting to get matrix fields to populate in an entry form (using the guest post plugin) and so far just can't seem to crack it. I've tried various examples, but all assume that you're just editing an existing entry, not posting a new one (that a non-cp user would never need to edit).

The code is so wrong there's little point posting it.

I'm sure if someone can point me in the right direction, I'd be able to take it from there.

The matrix field is called traveller, the block is called travellerDetails and the field I want to try is called travellerTitle (a dropdown field).

3 Answers 3


The trick, as it were, is to define the Matrix field in your form as an array.

First, the Matrix entry field itself:

<input type="hidden" name="fields[traveller][new1][type]" value="travellerDetails">
<input type="hidden" name="fields[traveller][new1][enabled]" value="1">

Then, for each field within the Matrix block:

<input type="text" name="fields[traveller][new1][fields][travellerTitle]" value="">

If you are going to allow for more than one Matrix field in your form, you must increment the block number, e.g. "new1" becomes "new2". You can do that with some JS.


Do you have something like {{ entry.traveller.one().travellerDetails.one().travellerTitle }}? Even if you limit the number of matrixes to 1, Craft still creates an array, so you need to include .one() after the matrix field name and matrix block name. If you use a for loop, you wouldn't need the .one().


Thanks to everyone for their input, but I solved the problem using an alternative fieldtype. I'd have rather stuck with a native fieldtype, but deadlines are an unforgiving mistress.

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.