Skip to main content
8 votes
Accepted

How do I allow a user to remove an uploaded asset from a front-end entry form?

File fields are used for uploading new images. To delete all the Assets for a field, submit a hidden field with no values. <input type="hidden" name="fields[assetsField]" value="" /> If, on ...
Andris Sevcenko's user avatar
8 votes
Accepted

Entry Form - Multiple Entries & Entry Type & Parent

A little bit late but here it is. Go to https://pluginfactory.io/ and create a plugin, you need at least 1 Controller but you can leave the Name value blank to create a controller with the same Name ...
Robin Schambach's user avatar
8 votes
Accepted

Craft 3: Front End Entry Form

Craft 3 uses kebab-case paths instead of camelCase paths Your action parameter must be entries/save-entry Its all stated in the docs Edit: generally a good idea is to inspect the html in your cp form ...
Robin Schambach's user avatar
5 votes

Matrix fields in an entry form

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="...
Roi Agneta's user avatar
  • 1,463
4 votes
Accepted

How to save entry to the current site from the front end?

The parameter is called siteId <input type="hidden" name="siteId" value="{{ currentSite.id }}">
Robin Schambach's user avatar
3 votes
Accepted

Front-end entry form not updating custom fields in existing entry

You need to pass your custom fields in a fields array, try: {{ input('text', 'fields[headline]', entry.headline, { required: true, class: entry.hasErrors('headline') ? 'text error' : 'text' }) ...
Oli's user avatar
  • 7,515
3 votes
Accepted

Matrix Entry form

Of course it clears all the existing matrix elements if you update an entry. For craft it's like you delete the existing matrix blocks and create a new one. In order to keep all of them you have to ...
Robin Schambach's user avatar
3 votes
Accepted

how to specify entry type on front end entry form?

You just need to specify a hidden input with the typeId set correctly. i.e. <input type="hidden" name="typeId" value="{{ entry.typeId }}">
Brad Bell's user avatar
  • 67.6k
3 votes
Accepted

Entry form replacing rather than appending data to a matrix field

The old blocks are likely being discarded due to the way Craft handles “delta saves” for complex fields like Matrix. This section of the Matrix field documentation should help you persist existing ...
August Miller's user avatar
2 votes

Can I make the front-end entry form send an email to a user group?

You can write a simple plugin that listens for the onSaveEntry event. When that event fires, you plugin could check the $isNewEntry param to make sure it's a new entry being saved and also check the ...
Brad Bell's user avatar
  • 67.6k
2 votes
Accepted

How to submit custom fields that are added in the right pane to your plugin?

I think I found the answer, correct me if I'm wrong but you can access your post data in your plugin with: craft()->request->getPost('fields') Not sure if this is the recommended way.
Thaoms's user avatar
  • 93
2 votes

Help with tags input field on a front-end entry form

I don't have any example code to offer, as I've never had a need to do something like this, but the way I see it there are 2 basic approaches: Use Javascript on form submission to first create the ...
Ben Croker's user avatar
  • 7,796
2 votes

Help with tags input field on a front-end entry form

First of all generally it's a really good idea to check how Pixel and Tonic has handled all the things. I know many people tend to dislike this hint but it's the best thing you can do. The developers ...
Robin Schambach's user avatar
2 votes
Accepted

Send currentUser id along with uploaded asset

Thanks for the assist. Just updated my Craft and all sorted.
Ian Ebden's user avatar
  • 894
2 votes
Accepted

How get field type in field layout

You can use the instance of test (docs) {% if field is instance of ('craft\\fields\\PlainText') %} or use className (docs). {% if field.className == 'craft\\fields\\PlainText' %} In full: {% for ...
Oli's user avatar
  • 7,515
2 votes

Craft CMS Entry Form Update Existing Entries without Creating New Ones

If you want to update an already existing entry then you should add a hidden field for the entryId like below: {{ hiddenInput('entryId', idOfTheExistingEntry) }}
Jay V's user avatar
  • 73
2 votes
Accepted

Saving data in a table field in a matrix field via entry form

The easiest way to figure this out is to edit an entry with these fields in the CP and monitor the network request that is made on save (or when saving a draft). Here's what I see in my browser dev ...
Ben Croker's user avatar
  • 7,796
1 vote
Accepted

'Request missing required body param' when submitting front end entry form - Craft CMS

You need to add sectionId to your form: {{ hiddenInput('sectionId', xx) }} If you have multiple entry types, you can also add typeId to the form: {{ hiddenInput('typeId', xx) }} For both examples, ...
Oli's user avatar
  • 7,515
1 vote
Accepted

How to validate custom field duplication on Front end form

It seems like the problem is that you're checking for a duplicate field value without taking site propagation into account – i.e. when Craft tries to propagate the newly saved entry to the other sites,...
Mats Mikkel Rummelhoff's user avatar
1 vote

New Matrix blocks aren't saving via front-end entry form

Thanks Oli! I got this working after making two changes: Add hidden field for declaring Matrix block type {# For the new activity block #} {{ hiddenInput('fields[planningSchedule][sortOrder][]', '...
Roger Glenn's user avatar
1 vote

New Matrix blocks aren't saving via front-end entry form

You seem to be missing the block type: <input type="hidden" name="fields[planningSchedule][blocks][new:1][type]" value="text" /> and change the value to your block ...
Oli's user avatar
  • 7,515
1 vote

Advice on entry form file uploads and S3

This is a great learning resource. Worth the investment, IMO, if you're building a lot of sites with Craft CMS. https://craftquest.io/lessons/switching-from-craft-local-assets-volume-to-s3
Nick Merrill's user avatar
1 vote

Matrix fields in an entry form

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.
Christopher Dowson's user avatar
1 vote

Matrix fields in an entry form

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() ...
Jon Weedin's user avatar
1 vote

Does Craft have an equivalent of EE's Custom Fields loop for front-end entry forms?

Yes, you can do this without a plugin. You just need a frontend entry form, ala https://docs.craftcms.com/v3/dev/examples/entry-form.html Now if you want them to be able to add/remove fields, then ...
andrew.welch's user avatar
  • 11.6k
1 vote

Does Craft have an equivalent of EE's Custom Fields loop for front-end entry forms?

Personally I don't have any experience with Free Form but have been using Sprout forms for quite some time now. In Sprout forms your client can create entire forms or just add a couple of fields ...
Justin Dekkers's user avatar
1 vote
Accepted

Write to Craft via Element API

I'd caution against trying to adapt the ElementAPI plugin for this purpose, as it was designed to be read-only—it's basically a wrapper around Craft's ElementQuery interface, which does not handle ...
August Miller's user avatar
1 vote

Entry Form: Populate checkbox list from another entry and save options in entry

Could this be a reserved word? Generally I access fields using entry.registeredOccurances is there a reason you are using fields[registeredOccurances] and entry[dateFieldHandle]?
Clark Nelson's user avatar
1 vote
Accepted

How to update front end Craft new row - stuck on JavaScript

In the end I didn't get this working with replacing the new_0 in the fields array of the ajax content. I opted instead to limit adding new people to one at a time by having the new person button ...
CreateSean's user avatar
  • 1,983
1 vote

How to update front end Craft new row - stuck on JavaScript

You can get the number of rows you already have from the DOM, then use that to determine how many you'll have after you add a new one. $('#addPerson').click(function(e){ e.preventDefault(); ...
jasonetco's user avatar
  • 141

Only top scored, non community-wiki answers of a minimum length are eligible