Announcement

Collapse
No announcement yet.

Enter key not working correctly in checkout

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Enter key not working correctly in checkout

    Hi there

    I've just switched to using images for the checkout buttons (rather than the standard buttons). I've followed the instructions on page 29 of the v6 advanced user guide.

    For the 'back' button for example the code is now:
    <input type=IMAGE name=ACTION_BACK src="back.gif">
    rather than
    <input type=SUBMIT name=ACTION value="NETQUOTEVAR:BACKBUTTON">

    I've also copied the following text into 'orderscript.pl' as instructed, to define the functions of the buttons:

    if(!defined $::g_InputHash{"ACTION"})
    {
    if(defined $::g_InputHash{"ACTION_BACK.x"})
    {
    $::g_InputHash{"ACTION"} = ACTINIC::GetPhrase(-1, 503);
    }
    elsif(defined $::g_InputHash{"ACTION_CANCEL.x"})
    {
    $::g_InputHash{"ACTION"} = ACTINIC::GetPhrase(-1, 505);
    }
    elsif(defined $::g_InputHash{"ACTION_NEXT.x"})
    {
    $::g_InputHash{"ACTION"} = ACTINIC::GetPhrase(-1, 502);
    }
    }

    All of the buttons work fine apart from one major problem. When you hit the Enter key (as users are inclined to do) while filling in the forms, it now takes you back to the previous checkout page rather than forward!

    I wonder whether anyone can help . I want to keep images for the checkout buttons but Enter should definitely take the user forward to the next page, not back!

    Many thanks

    Jon

    #2
    I've found a piece of Javascript code from http://www.webcheatsheet.com/javascr..._enter_key.php, which disables the Enter key:

    <script type="text/javascript">

    function stopRKey(evt) {
    var evt = (evt) ? evt : ((event) ? event : null);
    var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
    if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
    }

    document.onkeypress = stopRKey;

    </script>


    This works well but it has to be in <head> section of the checkout pages. The only way I could think of doing this was to cut and paste it into the generated order00.html, order01.html & order02.html files.

    Has anyone got a better way of doing this so I don't have to alter these files every time I re-generate the website? Thanks

    Comment


      #3
      Has anyone got a better way of doing this so I don't have to alter these files every time I re-generate the website? Thanks
      Put it in the header of the PrimaryCheckout template. I forget the exact name but it might be Act_PrimaryCheckout.html.

      Mike
      -----------------------------------------

      First Tackle - Fly Fishing and Game Angling

      -----------------------------------------

      Comment


        #4
        Thanks for that Mike. Hadn't altered that template before so wasn't aware of it. Cheers

        Comment

        Working...
        X