1

With guest entries, am I able to redirect before actually saving the entry to say a review page for the user to see the entry?

I figure I could use the guestEntries.beforeSave hook, but not sure how I'd show the information on the page... or pass to a template.

Any suggestions?

1

You can listen for the beforeSave event, but by redirecting or rendering another template, you're essentially hijacking the request and cancelling the initial save.

You could fork the plugin and add some custom logic using a flag you can tell whether it's an initial save and to redirect, or it's a subsequent save and to continue processing as normal.

  • That's an idea. Is there a way I can on entry save, send those values to another template to review? So, the entry would be saved like normal, then I'd just have a field that called "Finished" or something, and on the next page form submit, I'd update that entry if they finished the review process. I'd rather not fork the plugin and keep it's original functionality. Thanks. – Erik Jun 20 '16 at 12:02
  • Yeah, you might be able to pull it off without forking... not 100% sure at the moment. – Brad Bell Jun 20 '16 at 17:47
  • I believe I have a way. I've created a custom plugin, I look for guestEntries.success. From there I redirect to a page with the entry id in the URL (hashed so you can't just put an ID in) and I will use my custom plugin to do all that and have a 'review' page. I'm not 100% this will work, I'm working my way through it today. I can detail it out later if anyone is interested. – Erik Jun 20 '16 at 17:52
  • Ahh, yeah... forgot about that event. If it ends up working out, you should definitely add your solution as an answer. :) – Brad Bell Jun 20 '16 at 17:56
  • I will. I just don't want to mess with any plugins that already work. If I can extend them somehow with hooks, then that's the route I want to take. – Erik Jun 20 '16 at 18:07
1

Not a Craft specific answer but you could use JS to prevent the form from submitting, and instead save those values in a cookie. After doing so, redirect the user to the review page, and use the cookie values to fill out a hidden form (all hidden except the submit/confirm button, of course).

  • That's not an option to be honest. Thanks. – Erik Jun 20 '16 at 12:01

Your Answer

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

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