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.

"1 billion of $$$": Set max character on text field using javascript - Please very important

Avatar

Level 1

Hi guys, i need some help.

I want to set the max character of a text field by using javascript. How i can do it?

Help please

3 Replies

Avatar

Level 8

In the change event of your field:

if (xfa.event.newText.length>5)//5 is the maximum length of the text input
      xfa.event.change="";

Kyle

Avatar

Level 1

thanks.

I've done in this way:

if(condition){

     this.resolveNode("textfield.value.#exData").maxLength = "750"; // 750 is the max length

}

it works!