Copy link to clipboard
Copied
Hi, I am working in Acrobat DC and created a terms and conditions form used for clients to sign and return. One of the dropdown selections allow the client to either "Authorize" or "Not Authorized" us to use their credit card. There are several text fields, whereby the default is "Not Required", however if they select "Authorize", I want those text fields to change to "Required". I have tried custom validation scripts recommended in other posts, but when selecting the "Authorize" option in the dropdown, those text fields still DO NOT change to required. The current script I am using is in the dropdown field:
this.getField("Name of text field").required = (event.value=="OTHER");
I have also tried similar script in each of the text fields, but to no avail.
I also tried to use this.calculateNow(); in the document level javascript, but again, doesn't change text fields to required after the dropdown selection.
Summary, any of the custom validation scripts I have used don't change text fields from Not Required to Required when completing the form.
Can anyone help?
Thank you,
Bob
Copy link to clipboard
Copied
Why does you compare event.value with "OTHER" ?
Copy link to clipboard
Copied
Sorry, my laziness, that was the sample code. Actual code for the dropdown is (trying to get text field "Text4" to be required)
this.getField("Text4").required = (event.value=="Authorize");
Copy link to clipboard
Copied
You can use this code as custom calculation script of dropdown field:
this.getField("Name of text field1").required = event.target.value == "Authorize" ? true : false;
this.getField("Name of text field2").required = event.target.value == "Authorize" ? true : false;
Add more field if you need.
Copy link to clipboard
Copied
Hi Nesa, thank you so much for replying! I just tried above and same result...when selecting "Authorize" from the dropdown, Text4 field still does not change to required. Ugh!
Copy link to clipboard
Copied
Did you change field name to Text4?
If you just want to change one field in this case "Text4" field use this code as custom calculation script of your dropdown field:
this.getField("Text4").required = event.target.value == "Authorize" ? true : false;
Also check that Authorize is spelled correctly and in drop down options tick 'commit selected value immediately'.
Copy link to clipboard
Copied
Yes, I had created a simple form to test this...text field is "Text4", I havve "commit selected value immediately" checked...everything is spelled correctly. Not changing Text4 to required still. Very frustrating as this seems to be a simple thing.
Copy link to clipboard
Copied
Can you share this form?
Copy link to clipboard
Copied
Hopefully this link works. Again, this was created as a simple test form (not the actual form that I will ultimately be using). The hope was to get this to work on a test form, then apply to the actual (which has proprietary info in it).
DropDown9 - simple dropdown with "Authorize" or "Not Authorized" as options
Text3 - text box (required)
Text4 - text box (not required) - this is the one I am trying to have changed to required if "Authorize" selected in DropDown9
Signature5 - signature box (required)
Copy link to clipboard
Copied
It's working for me, here is your file with code in it.
test it:
https://drive.google.com/uc?export=download&id=1ttmU-J2xmivwXR8lNf26ySyatuZlQ8Qt
Copy link to clipboard
Copied
Hi again Nesa, thank you again!! There are no errors, so in that sense "it is working". However (hopefully you can see in below), the form still allows signing and sending without requiring Text4 to be completed. I just tested it again...
Copy link to clipboard
Copied
The property required will not work when you use Adobe Sign.
For Adobe Sign use a Adobe Sign form and the features of Adobe Sign.
Copy link to clipboard
Copied
Thank you Bernd! Are you aware of script that will work when using Adobe sign?
Copy link to clipboard
Copied
Try the forum for Adobe Sign.
Copy link to clipboard
Copied
At validation of the dropdown use this:
this.getField("Text4").required = event.value == "Authorize" ? true : false;