Copy link to clipboard
Copied
Hello,
I allow myself to ask for more advice because the last time I had a great response very quickly.
I want to make a form, with fields circled in red to indicate that they must be completed.
But in the impression I would like these fields to be black and not red ?
Do you have any idea how to do this because after some research I did not find anything.
thanks in advance
Copy link to clipboard
Copied
Hello,
Thank you very much for your answer !
I have found another solution with javascript.
in the "format" tab of the text field, I added a personalized category with the following code :
var Myvar = this.getField("Nom_Adresse")
if ( Myvar.value == "")
Myvar.strokeColor = color.red;
else
Myvar.strokeColor = color.transparent;
Like that if the field is empty the border is red in printing and at screen, and if the field is not blank the border become transparent at screen and printing
otherwise I had thought to add à text field empty with border red above the text field, and the propriety of the fiel at not printable. like this, I can see a red border at screen and it not printable
Thk,
Jérémy
Copy link to clipboard
Copied
Create form fields with a black stroke and make them "Required".
So they will appear with a red stroke which is not printable (as the blue highlight).
That's all.
Copy link to clipboard
Copied
The red border for required fields is a user preference--and shouldn't really be changed on your end. (Technically, it could be disabled via JavaScript but that is not a good policy. I haven't tested it recently in newer versions.)
Also, I believe it only applies for electronic submission such as when using the Submit button. Users printing the form won't be affected by the required fields.
You should label the fields as required other ways, for example putting an asterisk in the field name and/or in the tool tip. Here is some info:
https://digitalaccessibility.uoregon.edu/guidelines/pdfforms
Lots more info via googling.
If the form does not have to be accessible, you can simply color code them yourself and not use the required setting.
Copy link to clipboard
Copied
Hello,
Thank you very much for your answer !
I have found another solution with javascript.
in the "format" tab of the text field, I added a personalized category with the following code :
var Myvar = this.getField("Nom_Adresse")
if ( Myvar.value == "")
Myvar.strokeColor = color.red;
else
Myvar.strokeColor = color.transparent;
Like that if the field is empty the border is red in printing and at screen, and if the field is not blank the border become transparent at screen and printing
otherwise I had thought to add à text field empty with border red above the text field, and the propriety of the fiel at not printable. like this, I can see a red border at screen and it not printable
Thk,
Jérémy
Copy link to clipboard
Copied
Your script should be used as a Validation script, not Format.
You can simplify this script and thus reuse it identically in all the fields concerned:
if (event.value == "")
event.target.strokeColor = color.red;
else
event.target.strokeColor = color.transparent;
Copy link to clipboard
Copied
Create form fields with a black stroke and make them "Required".
So they will appear with a red stroke which is not printable (as the blue highlight).
That's all.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now