6

If you're looking for a Craft 3 solution, I just got this set up on a project and hope it helps someone else out. First you'll need to add a custom field to your form. If you want your user to choose which field, then go with a dropdown or radio button and adjust the plugin logic below. My scenario required me using a hidden field and auto-filling in the ...


6

Your code is correct but you need to add another line near the top: <input type="hidden" name="fields[volunteerPositions]" value=""> From the documentation: If you are including a Checkboxes field on a front-end entry from, make sure to include a hidden input before the checkboxes, so that an empty value is submitted if no checkboxes are checked.


4

I literally just worked through this problem last week. Ran into the same issue, so I reached out to P&T. Turns out there is a "catch"... For a new user, the $_POST['groups'] value is passed as an empty array. And because of the order that it's processed, that empty array will actually overwrite what you've set manually. After working through it with ...


4

You need to include a timezone parameter to your form in order to get the correct one. <input type="hidden" name="postDate[timezone]" value="America/Los_Angeles"> If you don't include something like this in your frontend chances are high you'll receive the wrong time because it adds/subtracts a certain amount of hours. As soon as you include a valid ...


3

It doesn't seems possible natively, you should write a custom upload script. → Example #1 → Example #2 If it doesn't matter to add the images inside your rich text field, one more simple workaround could be to allow image upload to your assets using a separate upload field. → Uploading Files from Front-end Entry Forms


3

No errors are displayed because you are using AJAX to post your data. The errorList function works only with "regular" POST flow. When ajax response is available you need to grab it and append errors yourself. Try this code: $('#registrationForm').submit(function(ev) { ev.preventDefault(); var data = $(this).serialize(); $.post('/', data, ...


3

The code you are currently using is for the Set Password form that is used when a user forgets their password and you send them a Password reset email as documented at https://docs.craftcms.com/v3/dev/examples/set-password-form.html. Here is what I'm using to allow users to change their passwords on demand. It is based on the User Profile Form documented at ...


2

There is actually quite a bit of documentation on templating for various field types. Go to the Fields section of the online docs and then select the field you are interested in, e.g. you will find a very comprehensive templating guide for assets here


2

Solution Add the Redactor Sync callback function to the Vue.js instance to synchronize code/data between Redactor’s visual layer (UI) and the form’s <textarea> element. As per the Redactor documentation: Visual layer contains multiple temporary tags that allow visual editing. Synchronization with textarea inserts clean code to the textarea, ...


2

What kind of social interactions are you asking for? You can probably make most of this work in Craft but a lot of what you're asking for isn't really "built in." It's going to take a fair amount of effort on your part via some business logic to assign users to groups (or categories), etc. Frontend ability for users to create and join "groups". How ...


2

What you could try to do, though I don't know if this will work, is use the same form that craft CP uses in the backend. Using Google f12 I managed to find this: <form id="userform" class="pane" method="post" accept-charset="UTF-8" autocomplete="off" data-saveshortcut="" data-saveshortcut-redirect="users/{id}"> <input type="hidden" name="action" ...


2

I could not find a way to get a specific field for a model but you can get all and loop through them <!-- fetch all fields for your entryType --> {% for field in craft.entries.section('yourSection').type('yourEntryType').first.getFieldLayout().getFields() %} <!-- loop them and check the handle if it is your field --> {% if field.getField(...


2

In your Courier Blueprint listen to entry.beforeSaveEntry events and use this code for the Trigger Condition: {% set oldEntry = craft.entries({ id: entry.id, status: null, }).first() %} {%- set wasDisabled = oldEntry.status == 'disabled' %} {%- set isEnabled = entry.status == 'live' %} {{- wasDisabled and isEnabled ? 'true' : 'false' }}


2

Hard to know without seeing some template code, but the syntax for saving existing tags on a front-end entry form looks like this: <select multiple name="fields[fieldHandle][]"> <option value="13">Tag Name One</option> <option value="42">Tag Name Two</option> <option value="144">Tag Name Three</option> &...


2

Your sort order will change according to your HTML, so when you change your html, the sort order will change. You can use certain Javascript libraries to move your containers in your DOM, when you save the entry, your related entries will change. As for every relation field in Craft, you only have to insert an array of ids to relate the elements. <input ...


2

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 tags with an AJAX call. Use a custom plugin controller to handle the tag creation before passing the call on to it to the entry controller. Either way I would ...


2

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 are really good, they make good and useful comments and - at least for Craft 3 - they take care of the PHP Doc (in Craft 2 too but not as well) When I run ...


2

UPDATE and final answer: The culprit was having the general config setting validateUnsafeRequestParams => true and not having my redirect value hashed ({{ 'account/profile' | hash }}). I had completely forgotten I had that setting turned on. Mijingo has a good explainer of how this setting works: https://mijingo.com/blog/hashing-redirect-params-in-craft ...


2

You can get the user by email {% set user = craft.users.status(null).email("a@b.de").one() %} {{ user.id?? 'no user found' }}


2

You can use this {% if entry.hasErrors() %} Render a message here {% endif %}


2

Craft 3 This feature is available in Sprout Forms for Craft 3 (since v3.0.0-beta.22). The feature is disabled by default and can be enabled in the Sprout Forms settings. Craft 2 This feature exists in Sprout Forms for Craft 2 via the enableEditFormEntryViaFrontEnd config override.


2

There is a in operator to check if a variable is in a string or an array. Your entries field actually contains an object of type ElementQuery instead of an array of elements. All you need to do is to check if the current entry is in the list of selected entries {% set selectedEntries = entry.planItems.ids() %} {% set entries = craft.entries.section('...


2

I got a solution! <input class="remove" type="hidden" name="fields[{{ fieldHandle }}][{{ row.id }}][type]" value="{{ blocktype }}"> So the output will be "1" if you change it to "0" and safe your page the row is deleted! Really simple.


1

A user changing sensitive fields like passwords and email addresses requires a "elevated session" to do so, which requires them to enter their current password. You can see the template code to do that here for both Craft 2 and 3: https://craftcms.stackexchange.com/a/4715/57 You can configure the duration of the elevated session with the ...


1

This was a complication due to using the same browser for different user testings. Once all semblance of my admin user session/cookies were absent, the admin styles and scripts no longer appeared on this page.


1

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 write operations. In lieu of that, you might take a look at the CraftQL plugin, by Mark Huot. It supports sophisticated queries (reading), as well as mutations (...


1

That's a bug. The Asset wasn't saved because it would not be validated due to conflicting filenames. Thankfully, it's fixed now.


1

I would definitely not rely on client-side validation. It's fine to do it from a UX point of view, but you should also be doing it server-side as well. If this is a Vue app, write a custom validator for Vee Validate


1

You can't solve that with one input alone but you can make use of hidden fields (like craft does) Your solution would be 1 visible dummy checkbox and multiple hidden "real" inputs.. So your visible dummy checkbox triggers a javascript event, that sets the values of your hidden. Here is the syntax <input type="checkbox" id="user-type-select-{{ userType|...


1

Realized my issue, I was sending back the option labels instead of the option values for the dropdown fields in the form.


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