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 ...
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 ...
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 ...
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="...
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 }}">
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'
}) ...
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 ...
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 }}">
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 ...
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 ...
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.
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 ...
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 ...
2
votes
Accepted
Send currentUser id along with uploaded asset
Thanks for the assist. Just updated my Craft and all sorted.
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 ...
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) }}
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 ...
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, ...
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,...
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][]', '...
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 ...
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
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.
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() ...
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 ...
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 ...
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 ...
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]?
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 ...
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();
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
entry-form × 34matrix × 6
entry × 6
craft3 × 5
frontend-form × 5
frontend × 4
assets × 3
form × 2
plugin-freeform × 2
multi-site × 2
entry-type × 2
saveentry × 2
assets-field × 2
templating × 1
control-panel × 1
field × 1
structure × 1
plugin-elementapi × 1
emails × 1
ajax × 1
plugin-sproutforms × 1
tags × 1
javascript × 1
upload × 1
entries-field × 1