Showing/Hiding Signatures Based on Ranges

May 14, 2019

Copy link to clipboard

Copied

Hi - I'm struggling a bit with a simple field validation issue. Based off of one field (called "NUMBER") I would like the following to appear (and the rest to disappear if not applicable) within the following ranges:

  • 0-499,999 would trigger "Field 1"
  • 500,000-2,499,999 would trigger "Signature Block A"
  • 2,500,000-5,000,000 would trigger "Signature Block B"
  • 5,000,001+ would trigger "Field 2"

I can also post the custom Java script if that helps but I have no luck with this custom code as of yet.  Any help would be greatly appreciated. Thanks!

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

Yes, I don't think you need to use Adobe Sign to do it. It's perfectly feasible in a normal Acrobat form, and probably easier.

You can use this code to achieve it, as the custom validation script of the NUMBER field:

var v = Number(event.value);

this.getField("Field 1").display = (v>=0 && v<=499999) ? display.visible : display.hidden;

this.getField("Signature Block A").display = (v>=500000 && v<=2499999) ? display.visible : display.hidden;

this.getField("Signature Block B").display = (v>=2500000 && v<=5000000) ? display.visible : display.hidden;

this.getField("Field 2").display = (v>5000000) ? display.visible : display.hidden;

TOPICS
Acrobat SDK and JavaScript, Windows

Views

124

Likes

Translate

Translate

Report

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

Showing/Hiding Signatures Based on Ranges

May 14, 2019

Copy link to clipboard

Copied

Hi - I'm struggling a bit with a simple field validation issue. Based off of one field (called "NUMBER") I would like the following to appear (and the rest to disappear if not applicable) within the following ranges:

  • 0-499,999 would trigger "Field 1"
  • 500,000-2,499,999 would trigger "Signature Block A"
  • 2,500,000-5,000,000 would trigger "Signature Block B"
  • 5,000,001+ would trigger "Field 2"

I can also post the custom Java script if that helps but I have no luck with this custom code as of yet.  Any help would be greatly appreciated. Thanks!

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

Yes, I don't think you need to use Adobe Sign to do it. It's perfectly feasible in a normal Acrobat form, and probably easier.

You can use this code to achieve it, as the custom validation script of the NUMBER field:

var v = Number(event.value);

this.getField("Field 1").display = (v>=0 && v<=499999) ? display.visible : display.hidden;

this.getField("Signature Block A").display = (v>=500000 && v<=2499999) ? display.visible : display.hidden;

this.getField("Signature Block B").display = (v>=2500000 && v<=5000000) ? display.visible : display.hidden;

this.getField("Field 2").display = (v>5000000) ? display.visible : display.hidden;

TOPICS
Acrobat SDK and JavaScript, Windows

Views

125

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
May 14, 2019 0
Adobe Community Professional ,
May 14, 2019

Copy link to clipboard

Copied

Is this a Adobe Sign Form?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0
May 14, 2019

Copy link to clipboard

Copied

No - should I convert it to an Adobe Sign Form?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0
Adobe Community Professional ,
May 14, 2019

Copy link to clipboard

Copied

What does you mean with "Signature Blocks"? This exists only in Adobe Sign forms.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0
May 14, 2019

Copy link to clipboard

Copied

I was still able to add a digital signature to an Acrobat Form, though I'm not familiar with the differences.

Once converted to an Adobe Sign Form, how can I go about this issue?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0
Adobe Community Professional ,
May 14, 2019

Copy link to clipboard

Copied

For Adobe Sign forms use the forum for Adobe Sign.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0
May 14, 2019

Copy link to clipboard

Copied

Well I would still like it to be a digital signature, and that does not seem to be what I am looking for.

In an adobe acrobat form, how would I do this making reference to the above field names?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0
May 14, 2019

Copy link to clipboard

Copied

Any help would be greatly appreciated if the form were to stay in Acrobat Form (as opposed to a sign form)!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0
Most Valuable Participant ,
May 14, 2019

Copy link to clipboard

Copied

Yes, I don't think you need to use Adobe Sign to do it. It's perfectly feasible in a normal Acrobat form, and probably easier.

You can use this code to achieve it, as the custom validation script of the NUMBER field:

var v = Number(event.value);

this.getField("Field 1").display = (v>=0 && v<=499999) ? display.visible : display.hidden;

this.getField("Signature Block A").display = (v>=500000 && v<=2499999) ? display.visible : display.hidden;

this.getField("Signature Block B").display = (v>=2500000 && v<=5000000) ? display.visible : display.hidden;

this.getField("Field 2").display = (v>5000000) ? display.visible : display.hidden;

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0
May 14, 2019

Copy link to clipboard

Copied

Thanks for the help, Try67. That still doesn't seem to be effective....

Also, Why does Number not have quotations on the first line?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0
Most Valuable Participant ,
May 14, 2019

Copy link to clipboard

Copied

Check the JS Console for errors, then.

It doesn't have quotes because it's not a reference to the field, but a call to the constructor method of the Number object in JavaScript, which is basically converting the string value to a number value.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0
May 14, 2019

Copy link to clipboard

Copied

The debugger says that Number is not defined. Any thoughts here?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0
Most Valuable Participant ,
May 14, 2019

Copy link to clipboard

Copied

Did you change anything in the code?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0
May 14, 2019

Copy link to clipboard

Copied

No but I do have a checkbox that show/hide the Number field (along with others). It now seems to break at the number field.

Debugger says it is null.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0
Most Valuable Participant ,
May 14, 2019

Copy link to clipboard

Copied

There's no reference in the code to a field called "Number". If you didn't change anything and the field names are correct then it should work. I'll need to see the actual file to help you further.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0
May 14, 2019

Copy link to clipboard

Copied

Thanks Try67! I got it to work! One last item - if the value of Number is null, I want nothing to show - how would I add that in?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0
Most Valuable Participant ,
May 14, 2019

Copy link to clipboard

Copied

That's a bit trickier... Change the code to this:

if (event.value=="") {

     this.getField("Field 1").display = display.hidden;

     this.getField("Field 2").display = display.hidden;

     // etc.

} else {

     // put the original code here

}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 14, 2019 0
May 15, 2019

Copy link to clipboard

Copied

Great, thanks for all the help!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 15, 2019 0