Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

How to suppress red highlighted Required Radio buttons?

Avatar

Level 2

Dear forum,

When grouping two Radio buttons to select "Yes" or "No", these field Value got the Type ""User Entered - Required" as I wanted to force a selection. Unfortunately, all required fields appear in the Preview PDF (and the final standalone PDF form) with a red frame to highlight that this is a required field. But I do not want to highlight this neither with a red rectangular nor with other colored elements but leave all highlighted objects in that light blue background that is created from the Adobe PDF Form toolbar.

My current workaround is to set the field Value to "User Entered - Recommended" but this is not what I really want to have.

Any idea how I can suppress that red color mode?

Thank you for reading and solving the problem,

CaBe

1 Accepted Solution

Avatar

Correct answer by
Level 3

Anyhow, if you want a working solution in which you have the "editable" fields in the light blue color without too much hassle, I would suggest two ways to go about it.

  • 1. Use the "Highlight existing fields" but do NOT use the standardized "required" property of the required fields, but instead do a simple verification on your own on the "preSave" event. The code would look like: (whenever user tries to save) Is 'requiredfields' empty? -> inform user that they need to enter the required fields. (and if you would like, you can add some sort of "highlighting" indicating which fields that are missed. To be clear, no weird color until they have actually tried to save and not having entered req. information. Otherwise you have to indicate it by text or something from the start. eg. have the text say "Tick the applicable checkbox. (required)" or they won't know which of the buttons actually are the required ones.)

  • 2. NOT use the "Highlight existing fields" but DO use the standardized "required" property, and instead do your own "coloring" of all required fields. The code would probably just be: color the input field in all different input fields on the startup of the document. (and maybe remove the color when something have been entered in the field).

These are the two quickest ways I can come up with that will allow you to keep the blue highlight, while removing the red ugly border from the required fields. I have tried a few different things as to simply try to simply "cover up" / remove the red color from the standard way, but so far I've had no luck.

Best regards, Mattias

View solution in original post

8 Replies

Avatar

Level 3

Hello CaBe.

I am afraid I am having a few issues understanding some things you write. I don't understand what you mean with "PDF Form toolbar" ? Does this mean (what I suspect you are trying to say) that you are enabling "Highlight Existing Fields" ? In either reader or acrobat when viewing your form? Aswell as you say you don't want to highlight this with red rectangular nor with OTHER COLORED ELEMENTS but you  WANT the LIGHT BLUE background (which is a highlight)? For me this is contradictory, I don't fully understand exactly what you want to achieve.

If this is the case, (that you do insist on wanting the light blue background but no red border for the required fields), I would suggest you script your own validation. I think I would script in the "preSave" event, something along the lines of

If(form1.page1.RadioButtonList.isNull){

     xfa.host.messageBox("Please enter information in the required fields.")

}

And also set up some coloring to specify which required fields that hasn't been entered. Because otherwise how would the user know the fields is actually required? And to be honest, then we are pretty much back at the "standard" functionality you are wanting to shut off. However, I am not really sure exactly what your idea is.

Anyway, I don't really see why you would want to have the "highlight existing fields feature" if not for realizing which fields are actually required.

Hope this is to some help, Mattias.

Avatar

Level 2

Hi Mattias,

Thank your for clarifying what I wanted to have. Seems that I was too fast in translating my German way of thinking into an English way of writing. You're right, it is exactly this behavior in the Reader, called "Highlight Existing Fields". This switch toggles all editable items to a light blue background. Unfortunately, the required fields (the radio buttons in my example) are not only highlighted this way but also get a red frame around, exactly the way you thought.

Your solution with that tiny script seems to be that what I want, but I don't know where and how to enter any script. Ahhh, now I found Ctrl+Shift+F5 to open a script editor line below the LC toolbar. There, I can select the "preSave" event? I entered your code example and compiled the Form (with "Required" settings for the radio buttons). But the compiled PDF shown in the Preview PDF tab keeps the red surrounding. How can I suppress this red frame? See screenshot attached. Under section 2, the Yes/No check boxes (that are radio buttons) are as "Recommended". Under section 3, the check boxes  are set as "Required".

LC_Req_vs_Rec.png

Regards,

Carsten

Avatar

Level 3

My idea, to be able to keep the blue color was to turn off the "required" property of the radio buttons. And that the script (explained in regular language) will -> check if the required boxes are empty -> and if so notify the user that they must answer them.

It's a bit tricky if you haven't scripted before so there are a few things to learn. My example was simply a generic example, to make it apply to your form you have to "refer" to your actual radiobutton list. If you check your hierarchy palette you work your way down the objects. "form1.page1.RadioButtonList" refers to the object named "RadioButtonList", on the page called "page1" on form "form1". This path can quite easily be seen in the hierarchy pallete.

May I ask on your reasoning on having those radio buttons required? What do you want to achieve by that?

Avatar

Level 2

Hi Mattias,

Thanks for spending so much time with my thread. In fact, I have extended experiences in writing VB scripts to control MS Excel. I assume that I can use parts of this knowledge when creating an Adobe (Java) script. This is that I understood your script example, which will notify the user to click at least one radio button before closing/saving this form.

As described, I was looking for a solution to display the form in a user defined way, i.e., highlighting all fields when the button in the Reader is clicked, but suppress extra highlighting Required fields.

Your question "May I ask on your reasoning on having those radio buttons required?" is easily answered. The form is used with hardware send back from the customer who must declare a "clean" product. To fill out all necessary fields, we wish to use a form that must be filled out completely. If we would leave the customer a free decision whether he clicks "Yes" or "No" or nothing, we will get several forms without all needed information. That happened in the past and we want to manage this for future releases of this form.

So, if you could provide a code (example) that suppresses the red frame around Required fields, I would appreciate. As a work around we will set these fields to "Recommended" only.

hth

Regards,

CaBe

Avatar

Level 3

Hehe, a funny part is that I have actually been starting to do some VBA scripts in Excel recently, and yes. As they both are scripting it is quite similar, however the languages are quite different.

After doing some more research, I found an interesting thing in livecycle.

Under "File" -> "Form properties" -> "Form Validation" there are these two pages called "Color Failed Fields" and "Color Mandatory Fields". And to me it seems what you want to achieve is in this "color mandatory fields" page, as there you can turn off the border color of mandatory fields but still keep the background color. However I can't seem to get it to change anything in the actual outputted form...

If you show "Events with Scripts" from the dropdown in the topleft corner of the script editor while having the "form" selected in the hierarchy tree, you will see all scripts that is currently in your form. And after having changed the options to remove border color (in the menus), there is some generated scripts there (they will be commented). And it should work, so I can't seem to understand why it changes nothing.

Here's also a page on the matter I found, the last page seems quite extensive. But same here I haven't got that solution to work yet neither.

How do you remove or change red border in Livecycle required

Avatar

Correct answer by
Level 3

Anyhow, if you want a working solution in which you have the "editable" fields in the light blue color without too much hassle, I would suggest two ways to go about it.

  • 1. Use the "Highlight existing fields" but do NOT use the standardized "required" property of the required fields, but instead do a simple verification on your own on the "preSave" event. The code would look like: (whenever user tries to save) Is 'requiredfields' empty? -> inform user that they need to enter the required fields. (and if you would like, you can add some sort of "highlighting" indicating which fields that are missed. To be clear, no weird color until they have actually tried to save and not having entered req. information. Otherwise you have to indicate it by text or something from the start. eg. have the text say "Tick the applicable checkbox. (required)" or they won't know which of the buttons actually are the required ones.)

  • 2. NOT use the "Highlight existing fields" but DO use the standardized "required" property, and instead do your own "coloring" of all required fields. The code would probably just be: color the input field in all different input fields on the startup of the document. (and maybe remove the color when something have been entered in the field).

These are the two quickest ways I can come up with that will allow you to keep the blue highlight, while removing the red ugly border from the required fields. I have tried a few different things as to simply try to simply "cover up" / remove the red color from the standard way, but so far I've had no luck.

Best regards, Mattias

Avatar

Level 2

Thanks again Mattias,

I will use the proposal #1 for my forms. Since I now can write some scripts, I will be able to create a pop up message when the required check boxes remain unticked.

Thread may be closed.

Regards,

CaBe

Avatar

Level 3

Yeah , I think that would be the most straight forward way of doing it aswell.

If you need any help feel free to ask.