ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Safecracker, pressing Enter/Return, or clicking Submit

April 14, 2011 11:38am

Subscribe [3]
  • #1 / Apr 14, 2011 11:38am

    marcamos

    57 posts

    Hello EE peeps,

    Got a weird issue here. With Safecracker, I currently have a wonderful workflow that goes like this:

    1. Visitor fills out form
    2. After clicking the Submit button or pressing the Enter/Return key on their keyboard, they’re brought to a “Thanks!” page that tells them some stuff
    3a. If they leave the site, or log off or whatever, and come back later, they can happily change the values of their form some more after logging in again (I’ve setup the templates & EE to check the current member and load-up their existing entry into the Safecracker form)

    …here’s where the issue comes up…

    3b. However, if, after submitting their form, they come right back to their application (by hitting the back button for example), and they make some modifications to their values, and they press the Enter/Return key on their keyboard, EE/SC submits that as a new entry in the channel. What I want it to do is update the existing entry.

    It’s weird because if they click the Submit button, it works as I desire. However, if they press the Enter/Return key on their keyboard, it doesn’t work as I desire.

    Is there anything in particular I should adjust to ensure that pressing the Enter/Return key on the keyboard does the exact same thing as clicking the Submit button—that being the entry is updated, rather than a new entry being created.

    Thanks!


    [Mod Edit: Moved to the CodeShare Corner forum]

  • #2 / Apr 15, 2011 5:15am

    John Henry Donovan

    12339 posts

    MarcAmos,

    That is more of a browser issue really. Hitting a back button like that is pretty unreliable when it comes to forms. There are JavaScript techniques to stop the use of the back button.

    Working on your form design too like making it quite clear that if they wish to edit the entry they just submitted that to click a link provided on the thank you page

    Does that help?

  • #3 / Apr 15, 2011 12:09pm

    marcamos

    57 posts

    Hey John,

    It’s helpful, but I’d love to find a way to make it work regardless of the actions of the user. If it’s truly impossible, then your suggestion is certainly a great last resort.

    Many thanks for your time.

  • #4 / Apr 17, 2011 2:40pm

    Greg Salt

    3988 posts

    Hi MarcAmos,

    I believe, as John Henry says, that this is mostly out of your control without using Javascript. However, using Javascript to alter the default browser behaviour is often undesirable as well. Shall I move this thread to the CodeShare Corner forum so that you can get some community input into this?

    Cheers

    Greg

  • #5 / Apr 17, 2011 3:00pm

    marcamos

    57 posts

    That’d be fantastic, thanks Greg.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases