• Resolved josippapez

    (@josippapez)


    Is there any way to execute form validation for profile registration form and show the errors if there are any before the page refreshes after clicking on “Register” button?

    The problem is that when I type in password and password confimation the form shows that the password should be by certain rules, like one capital letter and so on, after the page refreshes. That’s only one example, it’s also present for other required.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I made this with pure javascript.

    I think Ultimate Members forms uses only server validation, except for the confirm password field, which change border to red if password doesn’t match.

    For example, i use this code to validate userlogin field with the keyup listener and the um_after_register_fields hook.

    If username doesn’t match with my custom function (validate_ci), which is not in this example, the background field will be red. Otherwhise, will be green:

    function customID() {
        ?>
            <script>
    			
    	var valinput = document.querySelector("#user_login-534");
    			
    			valinput.addEventListener('keyup', function(){
      			if (validate_ci(valinput.value)){
        		valinput.style.background = "#9deb91";
    			} else{
        		valinput.style.background = "#eb91ae";
      			}
    			});
            </script>
        <?php
    }
    add_action('um_after_register_fields', 'customID');

    Hope this help.

    See ya!

    Plugin Contributor Champ Camba

    (@champsupertramp)

    Hi @josippapez

    Sorry for the late response. @nchaccal’s correct – We only have a server-side validation available for now but we’ve added this to our future improvements in the next couple of weeks.

    Please feel free to re-open this thread by changing the topic status to “Not Resolved” so we can get back to you.

    Regards,

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Form validation’ is closed to new replies.