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

Question

Question

Reject, Regular Expression

asked on February 24, 2022 Show version history

My "revision" field has a regular expression for validation set up:

When I reject the form, I get the following error:

I have the following javascript set up to ignore required fields:

$(document).ready(function(){

//Make comments required when rejecting, removing required fields
  $('.Reject').click(function() {    
    if($('#comments').val() == '')
    {
       alert('Please enter brief details into the Comments box before selecting this action');
       return false;
    }
    $('*[required]').each(function() { 
      $(this).removeClass('required')
      $(this).removeAttr('required');
    }); 
  });

})  //close document.ready

How do I get the rejection to also ignore the validation of the regular expression?

0 0

Answer

SELECTED ANSWER
replied on February 24, 2022

You can remove the pattern attribute and readonly attribute at the same time with the following:

$(this).removeAttr('readonly pattern');

You might also want to revalidate afterward to get rid of any parsley errors like so

$(this).removeAttr('readonly pattern').parsley().validate();

 

0 0
replied on March 2, 2022

Finally got around to trying this. It worked. Thank you!

0 0

Replies

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

Sign in to reply to this post.