Copy link to clipboard
Copied
Hi, I need a js code for acrobate pro dc to display next action only when the user writes something in text field.
Thanks
Maybe:
var xx=this.getField("xx");
If (xx.value != "") {your code}
run this script on focus off event
As the custom validation script of the field use this:
if (event.value) {
// place your code here
}
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...
I have a similar action in my pdf. It counts points from checkboxes.
You can check how many characters have been entered.
Maybe it will help you.
[Polish version of Acobat DC]
script in mouse exit event.
if (this.getField("xx").value.length >= 1) { app.alert("out: " + this.getField("xx").value + " :-)"); }
to display the current value, unfortunately you have to confirm the entry with the "enter" key. then you just need to move the mouse outside the frame and the script will run
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
Copy link to clipboard
Copied
Maybe:
var xx=this.getField("xx");
If (xx.value != "") {your code}
run this script on focus off event
Copy link to clipboard
Copied
As the custom validation script of the field use this:
if (event.value) {
// place your code here
}
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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...
Copy link to clipboard
Copied
Thanks once again for all the help that you provide! I will keep the code as your above suggestion, if the user must click outside the frame so be it, tx!
Copy link to clipboard
Copied
Copy link to clipboard
Copied
the given solution will probably not be useful to you. requires confirmation (enter) or clicking outside the frame 😞
Copy link to clipboard
Copied
Thanks a lot for your help regarding this issue, I think I will keep it simple and let the user click outside the frame to run the next action, tx for your suggestion!
Copy link to clipboard
Copied
script in mouse exit event.
if (this.getField("xx").value.length >= 1) { app.alert("out: " + this.getField("xx").value + " :-)"); }
to display the current value, unfortunately you have to confirm the entry with the "enter" key. then you just need to move the mouse outside the frame and the script will run
Copy link to clipboard
Copied
Caution.
the Mouse Exit event is sensitive to mouse movement; if the frame is small, it is easy with the mouse cursor to accidentally move out of the frame, which will run the script
Copy link to clipboard
Copied
look hier:
and script:
if (event.willCommit) {
/*
app.alert(":-)");
*/
this.resetForm([event.target.name]); // Reset field to lose focus
this.getField("YourNextField").value = event.value;
}
Copy link to clipboard
Copied
Od course, any your script can follow the event.willcommit
Copy link to clipboard
Copied
Copy link to clipboard
Copied
really nice feedback and option Krzysztof 🙂 tx a lote