7 votes

How do you set a user's group on a registration form?

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 ...
user avatar
  • 1,932
6 votes
Accepted

Frontend Form - Checkboxes cannot "all" be unchecked

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 ...
user avatar
  • 6,477
5 votes
Accepted

Date fields saving the wrong date from front-end form

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 ...
user avatar
4 votes

How do you set a user's group on a registration form?

This answer was originally written for Craft 2. For a Craft 3 solution, see Ryan's answer above. I literally just worked through this problem last week. Ran into the same issue, so I reached out to P&...
user avatar
  • 23.6k
4 votes
Accepted

Edit entry, on the front end, with the entries field

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 ...
user avatar
4 votes
Accepted

Frontend form to change Craft Commerce user's password?

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/...
user avatar
3 votes

Bad Request POST param “redirect” was invalid

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 ...
user avatar
3 votes

Form for admins to register users from the front end

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" ...
user avatar
3 votes
Accepted

How can I insert images into a Redactor rich text field in a front-end form?

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 ...
user avatar
3 votes
Accepted

AJAX Front-end User Registration Form not displaying macro errorList

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 ...
user avatar
3 votes
Accepted

how to check if a user email exists before creating a new user on a frontend form?

There are ways to check the email as soon as it's entered, but it's a bit more involved. The built-in controller action to create new users already does this check for you, so you should see if you ...
user avatar
  • 6,820
2 votes

Sanitize front-end entry form field

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 ...
user avatar
2 votes

Front End Editing with Entry From

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 ...
user avatar
  • 1,311
2 votes
Accepted

How can I validate a Redactor rich text field in a front-end form using the VeeValidate Vue.js plugin?

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 ...
user avatar
2 votes

Can Craft handle social-esque frontend user interactions?

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 ...
user avatar
  • 6,477
2 votes
Accepted

Get a field's required attribute in frontend form

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('...
user avatar
2 votes
Accepted

How to save multiple related entries on the frontend with 1 checkbox?

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 ...
user avatar
2 votes

Save an entry with tags

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 ...
user avatar
  • 66.5k
2 votes
Accepted

How to rearrange the order of blocks of a single matrix field using a frontend form?

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 ...
user avatar
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 ...
user avatar
  • 6,341
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 ...
user avatar
2 votes
Accepted

How can I use the Courier plugin to notify a user when an entry is enabled?

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() %} {%- ...
user avatar
  • 35.9k
2 votes
Accepted

How can I get the id of an unverified user on front-end?

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

Check for errors (any) on guest entry form (Craft 3)

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

frontend account edits

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 ...
user avatar
  • 66.5k
2 votes
Accepted

Sprout Forms - Can't save front end entry edits

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 ...
user avatar
  • 13.3k
2 votes
Accepted

How to remove a Super Table row on the front end?

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 ...
user avatar
  • 61
2 votes
Accepted

Front end form with Matrix won't add more than one row

According to the craft cms docs To show a “New Block” form, first come up with a temporary ID for the block, prefixed with new:. For example, new:1, new:2, etc. so, you need to you use prefix ...
user avatar
  • 462
2 votes
Accepted

Front End Entry Form - File/asset field not saving when ajax submitted

Finally found the answer after much time spent on it. The $(this).serialize() loses the file input - and can't submit. Updated ajax submit to $.ajax({ type: 'POST', url: url, data: new ...
user avatar
  • 1,769
2 votes

How to upload asset element on its own, not into an asset field (frontend form)

There is indeed an assets/save-asset controller. You will find it in vendor/craftcms/cms/src/controllers/AssetsController.php, the actionSaveAsset() function.
user avatar

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