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.

Text or Numeric fields will not display message when left empty- Required user input not working

Avatar

Former Community Member

I've been tearing my hair (what's left) out on this one, I cannot get any text fields or fields with numerical info to be set as "required". Someone can tab right past them without entering the information, or print the form with that field empty. I set the field to User Entered- Required under the value tab, and entered a empty message to be displayed if they leave it empty. I could not find an answer to this by doing a search. I did read something about using the exit command?, but could not follow the link to what appeared to be on this forum somewhere. I am using livecycle 8.0.

1 Reply

Avatar

Level 7

Hi,

User Entered - Required seems to just put a highlight around the field, i think you still need some code if you want to force people to fill it in.

In the exit event of the Textfield put:

form1.#subform[0].TextField1::exit - (JavaScript, client)

//if the textfield is empty when exited, show a message, after the message's ok button is clicked, focus back on the textfield

//if it isnt empty, do nothing

if(TextField1.rawValue == null)

{

xfa.host.messageBox("Input Required", "Alert", 3);

xfa.host.setFocus(TextField1);

}

else

{

}

This will handle ensuring that the textfield has an entry in it BUT, only IF the user enters the field. If they simply click to another field, this code will never run.

Fear not...you can catch that too.

If you use the same code but put it in the PrePrint and PreSave events for the form, it will ensure that if the user attempts to print or save the form and the field is blank, they will have to enter something to continue.