Okay
  Public Ticket #3358024
Customer Registration fields
Closed

Comments

  •  1
    Nick started the conversation

    Hello

    I was trying to implement forcing all capital letters at customer registration with the registration fields by css, but that failed.   Is there a way to force all customer registrations with the B2bking registration fields to be all capital letters when entered?   This will help my system greatly.


    Thank you 


    Nick Monroe

  •  2,218
    WebWizards replied

    Hi Nick,

    I worked on a code snippet that I believe can solve this.

    Please try to add this PHP code snippet to your site:

    add_action('wp_head', function(){
        ?>
        <script>
          // Define a named function to handle the form submission
          function handleFormSubmission(event) {
            // Loop through all input fields and update their values to uppercase
            jQuery(this).find('input[type="text"], input[type="email"], input[type="tel"]').each(function() {
              jQuery(this).val(jQuery(this).val().toUpperCase());
            });
          }
          // Wait for the document to be ready
          jQuery(document).ready(function() {
            // Attach a submit event listener to all forms with the class "register"
            jQuery('.register').on('submit', handleFormSubmission);
          });
        </script>
        <?php
    });
    

    A PHP snippet can be added to functions.php, or by following our guide here: https://woocommerce-b2b-plugin.com/docs/how-to-add-a-snippet-php-or-js/


    Kind regards,

    Stefan

  •  1
    Nick replied

    Works perfectly!  Greatly apprciate it!


    Thanks again!

  •   WebWizards replied privately