I have a Structure section called Competitions that allows users to submit one or more (usually three maximum) entries to judged photo competitions. However, they can only submit one or two if they wish.

  • Competitions (section)
    • Competition (parent entry type)
      • Submission (child entry type)

The Submission entry type's field that the users need to edit are:

  • Image order: a number field that is chosen from a radio button group. The number of buttons in the group corresponds to the number of entries the user has submitted. This is usually max 3. If I have the following order: Image 01, image 02, & image 03, and the user deletes image 02, image 03's order needs to change to 02.
  • Critique image: a ligthswitch field in a single radio button. They can only select one image for critique.

There's also an asset field for an image. This needs to be renamed according to the chosen image order. E.g: 01-compId-dateTime.jpg. I have this part working via a Craft 3 Module.

Here's an annotated screenshot to illustrate: https://cl.ly/ba29ed3cfc19

I tried to do this via Javascript (Vue.js), but it breaks when an entry is deleted. In the end, it's just not robust enough, and I prefer having a single save button that sends all form data to the server. Here's that attempt: How can I edit multiple entries via multiple front-end forms using Vue.js?

I found this post How do I create a plugin to create and save multiple entries from one front-end form?, but the answer isn't detailed enough for my current skill level, and it's for Craft 2. Same with this: Edit multiple entries at once through the front-end. The answer at Entry Form - Multiple Entries & Entry Type & Parent contains the detail I need, but it's for Craft 2.

Many thanks for your help.

  • It was Craft 2, but I did a competition entry like this using the Guest Entries plugin and a Matrix field for the images. I'd take the same approach again, most likely. Each image (up to 3) was a Matrix block within the same field. I'd question why image 3 would need renaming to Image 2 if the existing Image 2 is deleted though, although it should be easy enough to handle with JS. I just listed three file upload fields: Image 1, Image 2, Image 3 and if people left Image 2 blank, so what? Nov 1 '18 at 7:04
  • The image submissions (entries) also need to scored by 3 different judges. Each judge edits each entry and enters a score. Judge 1 -> score 1, Judge 2 -> score 2 etc. the field layout for submissions contains these score fields in addition to calculated fields via Preparse plugin to average scores, rank them and more. I have this part working OK. I'm just stuck on allowing users to change the order in which their submissions are judged without having to edit each entry individually. Nov 1 '18 at 13:46
  • So is it only about changing the order or editing them entirely? When your function to create those entries already exists there is no need to create the same function again just with the ability to change the order. Creating and Updating in Craft is basically the same Nov 1 '18 at 17:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.