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

Question

Question

Make Signature Field Not Required When Form is Rejected

asked on March 22, 2020

I have an approval process with a required signature field.  When the approval decision is "Reject", I would like the form to submit without requiring their signature.  Does anyone know the JavaScript to do this?

0 0

Answer

SELECTED ANSWER
replied on March 23, 2020

Since .clearfix will be a class in every signature field on the form, I would avoid using it.

The input is a child of the clearfix class which is a child of the signature field, so to specify only the specific field be changed, (assuming signatureField is the CSS class on the signature field) use $('.signatureField input') instead of $('.clearfix input')

2 0
replied on March 23, 2020

Good catch. I had copied this from another process I had where I needed to remove all required fields and cheated with .clearfix class

0 0

Replies

replied on March 23, 2020 Show version history

This is possible to do using just the approval decision buttons.  The trick is to set the Signature field to NOT required on the layout tab and set it as required using javascript.  Also you will need to give your signature field a class.  My example uses signatureField as the class.  Please see the following:

 

$(document).ready(function() {
  /* NOTE: on the Layout tab set the signature field to NOT required */
  
  /* This sets the signature field to required using javascript */
  $('.signatureField label').append('<span class="cf-required">*</span>');
  $('.clearfix input').attr('required','True');
  
  /* This removes the required class and asterisk from the signature field
     when the reject button is clicked, allowing the form to submit */
  $('.Reject').on('click',function(){
    $('.signatureField span.cf-required').remove();
    $('.clearfix input').removeClass('required').removeAttr('required');
  });
});

Hope that helps,

2 0
replied on February 8, 2023 Show version history

I was in need of the same functionality, and ended up here. Other than that accidentally targeting all signature fields rather than a specific one (as pointed out above), the other small issue with this code, I noticed, is that since click() runs before validation, if you had another field that was empty, and clicked Reject, the signature field's requiredness would still be removed by this code. You could then click Approve, and it would allow you to. Other than that, it appears to work as expected - so I just also bound to the click event on the Approve button, and added requiredness back to the field it might have been removed from, in the same way.

0 0
replied on March 23, 2020 Show version history

Hi Vanessa

I think the way to do this is to use a Radio Button to accept the value of Approved or Rejected.

If the user selects Approved then use a field rule to show the required Signature field.

Only display a Submit button for your Action Button (This could be hidden by javascript if you so choose until the radio button is completed)

In your BPM you can use the radio button in an Exclusive gateway for your routing

 

@SteveKnowlton

1 0
replied on March 23, 2020

Thank you Steve for your response.  I thought about doing that, but I would prefer to do it based on the approval decision buttons instead of using field rules and addig another field.

0 0
replied on March 23, 2020

Thank you Shawn and Bert!  With a combination of your answers, I was able to get my form to behave exactly how I wanted. smiley

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

Sign in to reply to this post.