Skip to main content
CintiaC
Known Participant
February 15, 2021
Answered

Execute a JavaScript when a user writes something in an <input> field

  • February 15, 2021
  • 2 replies
  • 4605 views

Hi, I need a js code for acrobate pro dc to display next action only when the user writes something in text field.

Thanks

 

 

This topic has been closed for replies.
Correct answer Krzysztof_OciecG

Od course, any your script can follow the event.willcommit


for a joke: mouse exit event changes the string: test ONE / test TWO, and each character entered increases the frame "NextTabField". Space resets its dimensions to the initial 😉

this time the construcion if(even.value) {...} was used in the custom Format field

2 replies

try67
Community Expert
Community Expert
February 15, 2021

As the custom validation script of the field use this:

 

if (event.value) {

// place your code here

}

CintiaC
CintiaCAuthor
Known Participant
February 19, 2021

This code work perfectly but it´s possible to display the next action for example after 10 characters? right now the action is displayed when they write and click out of the text field.

try67
Community Expert
Community Expert
February 19, 2021

To do that you would need to use the Keystroke event. It's possible, but more complicated. And you need to provide a more detailed description of how you want it to work...

Inspiring
February 15, 2021

Maybe:

var xx=this.getField("xx");

If (xx.value != "") {your code}

 

run this script on focus off event