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.

Required field

Avatar

Level 2

How can i make an field require an input before they van type in the next field.

Is there a code?

3 Replies

Avatar

Level 2

Him

On Exit event, write the below code

Textfield1.mandatory = "error";

xfa.host.setFocus(this);

another solutions is

if(Textfield1.rawValue == "" || Textfield1.rawValue == null)

{

app.alert("This is an mandatory field");

xfa.host.setFocus(this);

}

Avatar

Level 2

Tnx!

When i use the code for more than one field i get an error.

Adobe will give an error for all field before i can type new info in the field.

Avatar

Level 1

I realize that this is 4+ years later but in case someone else runs across this issue, I figured it by combining sonya1's "another solution" with some javascript I have for ghost text to come up with this that works for me:

if (this.isNull) {

app.alert("This is a required field!");

xfa.host.setFocus(this);

}

ENSURE THAT LANGUAGE IS SET TO JAVASCRIPT AND NOT FORMCALC!