Announcement

Collapse
No announcement yet.

Submit on "enter" - Gift Registry access

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

  • jleclair
    replied
    i'm going to guess you don't have an onReady script block so just add it at the bottom of your page. and yes you can put it on the html template file you are referring to.

    you can copy and paste this in the footer (I corrected my bonehead syntax error from before) and it should work for you.

    Code:
    <script>
    jQuery(document).ready(function(){
       jQuery('input[name="txtRegPassword"]').on("keyup", function(evt){
          if(jQuery(this).value.length >=0){
               if(evt.keyCode == 13 || evt.keyCode == 169){
                  document.frmForm.submit();
               }
          }
       });
    });
    </script>
    the document.ready function will only run once the dom is completely loaded but much faster than we as humans can react to the page. This will ensure the listener is in place when it needs to be but not too soon.

    as a rule of thumb, any non-essential javascript you write should always go at the end of the page after the html. If you NEED something to run as the page is loading.. move it up the DOM

    Leave a comment:


  • JenCat
    replied
    Thanks so much. I am eager to give that a try. Where on the page should I put the jquery code? Also, should I be placing is on the gift_registry_password.html page?

    Leave a comment:


  • jleclair
    replied
    its submitting on enter for me.

    lets say its not for everyone for the sake of argument. This is what i would do.

    Code:
    jQuery('input[name="txtRegPassword"]').on('keyup", function(evt){
       if(jQuery(this).value.length >=0){
            if(evt.keyCode == 13 || evt.keyCode == 169){
               document.frmForm.submit();
            };
       };
    });
    Now for the breakdown. This code will attach a listener for the input box you are entering into. Every time a key is pressed, it will check to see if there is a value in the box and that its not blank. If it is not blank, it will then check to see if the key last pressed (thus the keyUP command is when someone presses a key and then lets it go) is the enter key. (13 is the main enter key and 169 is the enter key on the number pad.. hopefully.. i googled.) If it is indeed the enter key, it submits the form. If not, nothing.
    Last edited by jleclair; 01-16-2013, 03:42 PM.

    Leave a comment:


  • JenCat
    replied
    Sorry for the confusion.

    Let me try again.

    When I changed the code for the button as you stated in a previous post, to be onSubmit... it didn't do anything. In fact, it made it so that the button was no longer "clickable".

    So, I had to keep that as "onClick". ...

    I think maybe the code that has to be changed is at the top of the page, perhaps in conjunction with what you suggested. I just know there has to be a way to make the "click here" button work when pressing enter.


    HTML Code:
    <form action="giftregistry_home.asp" name="frmForm" id="frmForm" method="post" autocomplete="off">
    	<input type="hidden" name="action" id="action" value="">
    	<input type="hidden" name="intCustId" id="intCustId" value="">

    Leave a comment:


  • cbsteven
    replied
    Sorry, can you re-write your last post for clarity? I am having a really hard time following what you mean.

    Leave a comment:


  • JenCat
    replied
    Thank you so much. So, I made that change, and when I "inspect element" using chrome, I see that I have made the change correctly.

    Now I think there is just one more issue to fix. The page is picking the first link on the page, instead of the button, when pressing submit.

    I will send you a screen shot separately, but basically the issue is that the Enter button is registering the "Gift Registry Home", which I would like to remove altogether from this page anyway. (I don't want people seeing the "gift" registry part). If I can get rid of that, then I think pressing "enter" will work correctly.

    Any thoughts on where I access that??

    here the page I am referring to...

    Welcome to Stadium System - Full-Service Athletic Equipment Dealer & Reconditioner Since 1948

    Leave a comment:


  • cbsteven
    replied
    It is hard for me to test a solution since I don't really use a page like this. But I have narrowed it down to one line:

    The file is giftregister_home_password.html

    The line in question is
    Code:
    <input type="button" name="cmdViewList" onClick="javascript:viewRegistry('[custid]');" class="btn" value="[giftregistry_home-select-registry]" onMouseOver="this.className='btn_over'" onMouseOut="this.className='btn'">
    try changing it to:

    Code:
    <input type="button" name="cmdViewList" onSubmit="javascript:viewRegistry('[custid]');" class="btn" value="[giftregistry_home-select-registry]" onMouseOver="this.className='btn_over'" onMouseOut="this.className='btn'">

    Leave a comment:


  • JenCat
    replied
    Well for me, it is not working correctly. If I press "enter, it brings me to this page:

    Welcome to Stadium System - Full-Service Athletic Equipment Dealer & Reconditioner Since 1948


    Now go back to the orginal page and press the "Click Here" button with your mouse (after entering your code) and it should bring you to a list of the items for that team.

    That's what I need the page to go to when someone presses enter on their keyboard. ... it needs to lead them to the view_giftregistry page.

    Leave a comment:


  • cbsteven
    replied
    The link above "Enter code and click" now works for me when hitting enter

    However the form where you search for your team still seems to require a click.

    So is this an improvement over what it was before?

    Leave a comment:


  • JenCat
    replied
    OK, wow... I just figured out where the problem was coming from... it was in "store language" setting.

    In an effort to make people really see that they had to CLICK the enter button, I had put in my store text the following

    Enter code and click "view team sales"

    .............

    I think the quotes were causing the problem. Because I just changed it to say only be Enter code and Click


    and now it works

    Welcome to Stadium System - Full-Service Athletic Equipment Dealer & Reconditioner Since 1948


    Of course, now I am back with the original problem, where I need to make sure this works when someone presses enter, and not only when they click on the button.

    So, i think I need som kind of modified javascript for a submit on enter

    Leave a comment:


  • JenCat
    replied
    Ok I did just rename all the gift registry files. I will see if I can send a screenshot to you via PM.

    I then cleared my cache and reloaded the site... still no go.

    Not sure where I am going wrong.

    Leave a comment:


  • cbsteven
    replied
    Got your PM with the code.

    When I try to use it I get a javascript error that viewRegistry() is not defined.

    If you replace this with the common file properly that should not be a problem. That file (giftregistry_home.html) has that function defined within it.

    Did you try renaming all of the giftregistry-related files to force the template to use the common version?

    Leave a comment:


  • cbsteven
    replied
    To revert to the original version, just rename your customized version something different (gift_registry_home-custom-backup.html or something). That will force the system to use the 'common/default' version

    Then clear your cache for good measure

    No, there is no restriction to simultaneous users.


    It is hard for me to test this page because I am not sure how it is supposed to be used, or what code to enter.

    Leave a comment:


  • JenCat
    replied
    I was using a modified version of the gift_regsitry_home, but now I am trying to revert to the original version. Now I cannot even access the registry by clicking on the button.

    Here is the link to the page

    Welcome to Stadium System - Full-Service Athletic Equipment Dealer & Reconditioner Since 1948

    Is there some restriction on the number of people that can be in a gift registry at once? If so, that is not good.

    Leave a comment:


  • cbsteven
    replied
    Are you using the stock gift_registry_home template file, or do you have a modified version inside your Template's folder?

    Leave a comment:

Working...
X