You are viewing limited content. For full access, please sign in.

Question

Question

Disable Submit Button when ID fields don't match

asked on November 2, 2020

I copied this code from the Laserfiche documentation.  The error message displays, but the submit button is not disabled.  Any suggestions?

 

$(document).ready(function () {
    $('.email, .confirm').on('blur input', function () {
        if ($('.email input').val() != $('.confirm input').val()) {
            $('.Submit').attr("disabled", "disabled");
            if ($('.warningText').length > 0 || $('.confirm input').val() == ''){
                return; 
            } else {
                $('<p class="warningText">The email addresses you entered do not match.</p>').insertAfter('.confirm');
            }
        }
        else
            $('.warningText').remove();
        $('.Submit').removeAttr('disabled');

    });
});

1 0

Answer

SELECTED ANSWER
replied on November 2, 2020 Show version history
$(document).ready(function () {
  
  	//Disable Submit at the begining
  	$('.Submit').prop('disabled', true);
  
  	//Check when Key up
  	$(".email").keyup(function()
		{
          	//Check the emails
  			check_email();
		});
  
});

function check_email(){
 	
  	//Get Values
  	var x = $('#q4 input').val();
    var y = $('#q5 input').val();
  
  	if(x != y)
    {
     	//Disable Submit
  		$('.Submit').prop('disabled', true); 
    }
  	else
    {
        //Disable Submit
  		$('.Submit').prop('disabled', false); 
    }
}

Enjoy

 

1 0

Replies

replied on November 2, 2020

Resolved.  

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.