Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Do not allow digital signature until all required fields not blank

New Here ,
Mar 24, 2020 Mar 24, 2020

We are working on implementing digital signatures on forms due to our recent inability to meet directly with our customers. From what I read it seems I need to have a button that would unhide the digital signature field if it was checked and that would run a script to check if all of the required fields were not blank, if one was still blank it would alert the user they need to fill out all required fields. Can someone please help me with this script? I have tried but I am not able to get it to work correctly.

TOPICS
Create PDFs , PDF forms , Security digital signatures and esignatures
2.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 24, 2020 Mar 24, 2020

Hi,

 

Please share the script that you're trying to use so that the developers in the forums can assist you better.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 24, 2020 Mar 24, 2020

Thanks for the reply, I don't think anything i had found was too helpful. 
Basically any required fields blank then signature is not allowed. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 25, 2020 Mar 25, 2020

I got the bottom to work but now I want a popup to display a message that not all required fields are filled out if they click the read only signture box otherwise it is confusing

 

if(event.value != "" && this.getField("Last Name").value != "" && this.getField("First Name").value != ""
&& this.getField("Street Address").value != ""
&& this.getField("City").value != ""
&& this.getField("Zip").value != ""
&& this.getField("Phone number").value != ""
&& this.getField("Date_of_Birth").value != ""
&& this.getField("Sex").value != ""
this.getField("Signature").readonly = false;
} else {
this.getField("Signature").readonly = true;
}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 25, 2020 Mar 25, 2020

You can use this code to do it:

 

this.getField("Signature").readonly = !validateRequiredFields(this);

function validateRequiredFields(doc) {
	var emptyFields = [];
	for (var i=0; i<doc.numFields; i++) {
		 var f = doc.getField(doc.getNthFieldName(i));
		 if (f!=null && f.type!="button" && f.required && f.valueAsString==f.defaultValue) {
			emptyFields.push(f.name);
		}
	}

	if (emptyFields.length>0) {
		 app.alert("You must fill in the following fields:\n" + emptyFields.join("\n"));
		 return false;
	}
	return true;
}	
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 25, 2020 Mar 25, 2020

Thanks a bunch, but where exactly does this go?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 25, 2020 Mar 25, 2020

As the Mouse Up event of your button.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 25, 2020 Mar 25, 2020

That worked, thanks so much!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 27, 2020 Mar 27, 2020

One small thing. It seems that this script only works on the first instance of mouseup. If I click it a second time as a user who thinks they are ready but are not actually I get no message?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 27, 2020 Mar 27, 2020

No, that should not be the case. Can you share the file with us?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 29, 2020 Mar 29, 2020

I can't. I will try to recreate it but it might take a day or two. I will tell you I click the digital signature box, I get the popup, then if I try to click the digital signature box again I get nothing. If I hover over the box the mouse arrow has a little box next to it like it is stuck. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 21, 2024 Feb 21, 2024
LATEST

Thank you for this! I used this script, changing the signature field name to mine (Signature_0), but when fields are missing, my signature field is set to read only and I cannot reselect it after completing the missing fields.  Even when I RESET the form, the signature field remains read only - I can manually remove the read only setting, but users won't have that ability.  

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines