xpertbot / craft-wheelform

Craft CMS 4 Form with Database integration
MIT License
66 stars 32 forks source link

Last submission entry using ajax form submission #272

Closed vinodsnayvik closed 2 years ago

vinodsnayvik commented 2 years ago

I want to get last submission form entry or id of that entry. It is available when we request using url submission or can say without Ajax but when I submit form using ajax then i'm getting message, success, data and errors(filled according to errors). I'm not getting last submission entry ajax request.

Is it possible using Ajax request ?

xpertbot commented 2 years ago

I will add a solution for this, in the next couple of days (in a small patch). Thank you for bringing it up.

vinodsnayvik commented 2 years ago

@xpertbot How can i get last entry in version 2.7.2 because i'm using craft 3 and can't upgrade to craft 4 now.

So do you have any suggestion ?

xpertbot commented 2 years ago

Hello @vinodsnayvik, Since Craft 3 plugin is now on maintenance mode, features are no longer being implemented. However, a good workaround for your use case can be: Submit the form with Ajax, once successful, you can reload the page and get the Session variable "wheelformLastSubmissionId" that's the last save message in the database. An example of how the Service class does it is here. The problem with the entry is, that a new request needs to be made (page reload, redirect, etc) in order to access the session variable. if you really need to stick to ajax, you can:

Let me know if you have any more questions,

vinodsnayvik commented 2 years ago

@xpertbot Thanks for your suggestion. I made a request after submitting form and get the last item from table using a small module creation.