Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected update of non-submitted Entry from another Section #62

Open
stevenjwright opened this issue Aug 1, 2020 · 6 comments
Open
Labels

Comments

@stevenjwright
Copy link

Description

When saving an entry from the front-end, an entry with the same title has its sectionId and typeId updated in the entries database table.

Steps to reproduce

  1. Create an Entry in a Section (sectionA), title 123-456-789.
  2. Configure Guest Entries set to only allow guest submissions on 1 section sectionB.
  3. The site uses Sprig to post the form via AJAX on page load.
  4. The form uses sectionB's UID as a hardcoded value.
  5. The form submits the following data (in addition to the section id and CSRF token):
  • A Url Parameter of l as the new entry's Title.
  • The Url Parameter of l as a plain text field activeLicenseKey.
  • The User's Session ID as a plain text field sessionId.
  1. Load the page where the auto-submitting form is with a URL Parameter l=123-456-789.
  2. Assuming this has now fired the POST request to the system, the unrelated entry in sectionA will now not be shown on the entry view in the CMS, and its row in the entries table of the database has had its original typeId and sectionId be updated to that of the entry for sectionB.

Additional info

I should say that when this occurs, there is still a new additional record in the database for the new entry that has been submitted. The new entry in sectionB is in full working order. If I manually change the typeId and sectionId back for the original entry, it sits back in the entries view in the CMS, but with a URI value that correlates to the new entry in sectionB.

  • Craft version: Craft Pro 3.4.29.1
  • PHP version: 7.3.13
  • Database driver & version: MySQL 5.5.5
  • Plugins & versions:
Conditional Fields | 0.0.6
Control Panel Nav | 3.0.12
Craft Commerce | 3.1.12
Digital Products | 2.4.0
Feed Me | 4.2.3
Guest Entries | 2.3.0
Redactor | 2.6.1
Sprig | 1.0.0-beta.9
Stripe for Craft Commerce | 2.3.1.1

Code and a Video of this happening are available if you require 👍

@stevenjwright
Copy link
Author

stevenjwright commented Aug 2, 2020

Just to add to this, since posting, I've also noticed that it doesn't seem to matter what entry was created beforehand, it seems to soft delete it anyways.

By that, I mean, I created an a new entry in sectionA (as per steps above), then afterwards I created an entry in sectionC, nothing to do with the other sections. I went to the page again and the form fired, this time, it updates the database for the entry from sectionC, but the one from sectionA remained intact... this suggests to me that for some reason, it is retrieving and updating a row of the last saved entry, irrespective of the section it belongs to.

image

@philipboomy
Copy link

@stevenjwright Slightly unrelated but I am trying to use Sprig with the guest plugin and I cant get errors to work. Did you manage to get those working?

@stevenjwright
Copy link
Author

@philipboomy I've actually got this to work in the end with Sprig - what's happening for you at the moment, are you getting any errors?

Happy to help how I can 👍

@philipboomy
Copy link

philipboomy commented Jan 30, 2021

@stevenjwright

Thanks for replying.

I can get it to post but I cant get it to show any errors if I leave out a field. I wonder if its because of the way Craft assign the new entry variable after submitting.

Did you manage to get that part working?

@stevenjwright
Copy link
Author

@philipboomy Oh I see - sorry, read your post early hours so didn't read properly.

I don't actually think I did get it to show any errors for me.

What's your use case? Are you trying to do some field validation or something, or are you needing the errors for debugging? Just trying to think of a workaround for you!

@philipboomy
Copy link

@stevenjwright No worries :) I would like to show errors for validations to the submitter. Might have to write a custom module or not use Sprig. I just dont want to reinvent the wheel now that we got a Guest Entry Plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants