Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Mandatory fields - error message

Avatar

Level 4

Hello again

Long time no see ;D

I've got some major problem with a group of checkboxes, where at least one has to be checked.

The main question I've got about these is: Is there any AdobeReader version that gives a hint in the error message to which field is checked?

I got a bit afraid of other versions since my last try ended in a doubled red border on newer versions. (Alternative is no border in older ones.)

Another question would be, if I can cause the error-message to appear just by scripting? (It appears in different languages I think.)

I just don't wanna mess up the form even more...

Thanx already

Lisa

2 Replies

Avatar

Level 4

hi,

not sure i totally understand your question -

but if you want to have an error message pop up if none of the checkboxes are filled in this can be done

a simple solution would be to just have a script that says if a = null and b = null  and c= null  and d = null then produce an error message saying "you must make a selection" or whatever

that would look something like

if( A.rawValue == "0" && B.rawValue == "0*"*) && C.rawValue etc.....  {

xfa.host.messageBox("You must select a checkbox [or whatever].";

}

the above would produce an error popup if NO checkbox  was ticked

not sure if thats what you need - hope so

you also said "The main question I've got about these is: Is there any AdobeReader version that gives a hint in the error message to which field is checked?"

this CAN be done - but im not sure what you want your form to do - you can use a script to tell someone that they have ticked the wrong box - so if they can only tick a combination of choice a and choice a OR choice b and choice b for example and they click a and b - you could have code to say you have selected a and b but you cant do that

-- if you give some more detail on what you want im sure someone on here can help - im happy to try

you also asked if - error message can be done by scripting --- short answer is yes  --- an error message box is the easiest - it uses the "xfa.host.messageBox" function as demoed above

so once you work out your requirements (if x then y) you can place the code on a suitable event - (have not seen you form to suggest one) and simply have it say "hey fix up your choices for those checkboxes" (or whatever)

if you want to test the xfa.host.messageBox function try using a new blank form and putting a standard button on it - then put the messagebox function on the click event with your desired text (in the format above) - set to dynamic etc and click it in the preview - you'll see what you would get from a basic message box

the message box function an be customized but hopefully that will get you rolling.

good luck

Avatar

Level 4

Okey... you got me totally wrong

Sorry... maybe it's my bad English.

Doing this mandatory stuff and so on is no problem. The borders on fields (radiobuttons) in a flowable form that will appear in all versions of AdobeReader are worse, but I can do that even in connection to other fields. (Toggle with hiding and showing between two different, nearly identical subforms)

An error message is easy too.

The problem is the standardized error message for mandatory fields (which I think first reads out the user's language and then puts out the text of this message in the users language).

I wanna execute THIS message.

And the second question is: does the content of the message or whatever change with the Adobe versions?

If yes: Is there a hint, which field is the one not filled out?

If not, I'll just make:

an email-fake-button with a script that will do as follows:

make invisible field optional;

check if all my radiobuttons etc. are checked;

if not make invisible field mandatory;

if boxes are checked - click realmailbutton