2

Is it possible to modify an field of an entry within the front-end? Something like this with an action URL: <a href="{{actionUrl('save/entry', {userfield:user.id}) }}">add user to userfield of current entry</a>

1 Answer 1

1

Sure... you'd just do it through whatever input tag you want using the name="fields[fieldHandle][]" syntax passing in the user's ID as the value.

There are examples of that here, under the "Relations" header:

https://straightupcraft.com/articles/craft-cms-field-guide-twig?view=input

You won't be able to do that should an anchor link GET request though... EntriesController::saveEntry() is explicitly checking for a POST request, so you'll want to do it though a proper form: https://craftcms.com/docs/templating/entry-form

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.