Copy link to clipboard
Copied
following up with another question related to filling data in adobe form from the file name...
how do I code to search the file name and if the part of the file name contains a certain name put (or pick) yes in the drop box in the Adobe form?
to clarify....
file name Doe, John (1234) SOAP 01.01.2018PK-4th wk.pdf
as this file name contains 4th wk, put "yes" in the drop box in the Adobe form.
drop box name is "4th wk".
THANK YOU for your help.
I should try to learn javascript and stop bothering people. once again thank you!
It should work with a drop-down field just as well as with a text field, but keep in mind that JS is case-sensitive, so if they values are "Yes" and "No" then you have to enter them like that into the script, not as "yes" and "no"...
Copy link to clipboard
Copied
Insert this code as a doc-level script in your file (I assume you want "no" to be selected if the file-name does not contain this string):
this.getField("4th wk").value = (/4th wk/.test(this.documentFileName)) ? "yes" : "no";
Copy link to clipboard
Copied
once again, THANK YOU so much!!
if you can can you make one correction? code you have provided works for text box. is there any way to apply the code to drop box in the form?
my drop box has only "Yes" and "No" option. if it doesnt work I have modified the dorpbox to text and it is working. just wanted to check if these can be done to drop box.
Please let me know. thank you much!
Copy link to clipboard
Copied
It should work with a drop-down field just as well as with a text field, but keep in mind that JS is case-sensitive, so if they values are "Yes" and "No" then you have to enter them like that into the script, not as "yes" and "no"...