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

Question

Question

How to Make Signature Field Not Required if a Radio Button is Selected?

asked on October 2, 2014

We have a form we were using with the old signature custom coded signature field and are now using the new signature field in Forms 9.2. We had the following jQuery that would allow us to submit the form if a specific radio button option was selected.

$('.districtmanaged').change(function () {
    $(this).find('input:checked').val() == "District" ? $('.Submit').removeAttr('disabled') : $('.Submit').attr('disabled', 'disabled');
  });

How can I make the new signature field not required if that same option is selected?

1 0

Answer

SELECTED ANSWER
replied on October 2, 2014

I ended up using this code to solve it.

$('.radiobutton input').change(function () {
  if ($(this).is(':checked')) {
    $('span.cf-required').remove();
	$('.req input').removeClass('required').removeAttr('required');
    
     } else {
       $('.req label').append('<span class="cf-required">*</span>');
       $('.req input').attr('required', 'True');
       }
  });

In this case, "radiobutton" is set as the CSS class of the radiobutton field and the "req" class is set on the field you DO NOT want to be required. Thank you Eric!

2 0
replied on July 14, 2015

I noticed that when the field with the .radiobutton class was being selected all fields were having their "span.cf-required" removed. I have updated the code to the following to make sure that only the field with the ".req" class is having its "span.cf-required" removed.

$('.radiobutton input').change(function () {
  if ($(this).is(':checked')) {
    $('.req .cf-label span.cf-required').remove();
	$('.req input').removeClass('required').removeAttr('required');
    
     } else {
       $('.req label').append('<span class="cf-required">*</span>');
       $('.req input').attr('required', 'True');
       }
  });

 

1 0

Replies

replied on October 2, 2014

Hi Blake,

The easiest way is making your new signature filed non-required and apply the css class used in your old signature field to it.

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

Sign in to reply to this post.