Appointments+ login form submit by clicking Enter

When logging with the appointments + login form fields, pressing enter doesn't submit the form when I have entered details in both fields. Is there a way to allow submitting the form by clicking Enter?

  • Ash
    • WordPress Hacker

    Hello Willi

    Please try the following code:

    add_action( 'wp_head', function() {
    	?>
    	<script type="text/javascript">
    		jQuery(function($){
    			$('.app_username, .app_password').keypress(function(event) {
    				var keycode = event.keyCode || event.which;
    				if( keycode == 13 ) $('.appointments-login_link-submit').click();
    			});
    		});
    	</script>
    	<?php
    } );

    You can use this code in your child theme's functions.php if the theme is not changed. Otherwise mu-plugin is the best option. To create a mu-plugin, go to wp-content/mu-plugins folder. If there is no mu-plugins folder then, create one. Now, inside the mu-plugins folder create file with name anything.php (make sure file extension is .php). Now start with a <?php tag and then put the above code.

    Hope it helps! Please feel free to ask more questions if you have any.

    Have a nice day!

    Cheers,
    Ash

  • Willi
    • Flash Drive

    Hi Ash,
    Thanks for providing this solution, I have placed the below code into a mu-plugin (I have others working already) but pressing enter doesn't submit the form still.

    <?php
    add_action( 'wp_head', function() {
    ?>
    <script type="text/javascript">
    jQuery(function($){
    $('.app_username, .app_password').keypress(function(event) {
    var keycode = event.keyCode || event.which;
    if( keycode == 13 ) $('.appointments-login_link-submit').click();
    });
    });
    </script>
    <?php
    } );

  • Ash
    • WordPress Hacker

    Hello Willi

    Would you please send me your admin login and cPanel details?

    You can send me privately in the following format:
    1. Please go to https://premium.wpmudev.org/contact/#i-have-a-different-question
    2. Select "I have a different question" if not selected
    3. In subject line put "Attn-Ash" (this will ensure that the email is assigned to me)
    4. Provide the wanted details.
    5. Add the thread link in the message so that I can track.

    Have a nice day!

    Cheers,
    Ash

  • Ash
    • WordPress Hacker

    Hello there

    Thanks for sending details.

    Looking at your site, it seems the site is not a wordpress site, instead this is a shopify site. Would you please check and confirm?

    And when you do so, would you please send me your login URL?

    Have a nice day!

    Cheers,
    Ash

  • Ash
    • WordPress Hacker

    Please check now, this is the latest code for you:

    add_action( 'wp_head', function() {
    	?>
    	<script type="text/javascript">
    		jQuery(function($){
    		    $(document).on( 'keypress', '.app_username, .app_password', function(event){
    				var keycode = event.keyCode || event.which;
    				if( keycode == 13 ) $('.appointments-login_link-submit').click();
    		    } );
    		});
    	</script>
    	<?php
    } );

    Have a nice day!

    Cheers,
    Ash

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.