Copy link to clipboard
Copied
hi,
i have a form with 3 text fields.
i want to go to the next field if the current field if empty.
i used the following code and it works but, when the focus is set to the next field and the field is not empty the text in the next field is marked.
if the text is marked and the user type a letter the text in the field gets deleted.
how can i prevent that?
if ( event.fieldFull || event.willCommit ) this.getField("NextTabField").setFocus();
Copy link to clipboard
Copied
You need to better explain what you want to achieve.
What event should trigger this action? When the user exits the field? Enters it? Something else?
Copy link to clipboard
Copied
hi,
because i have 3 fields for the user to enter free text, i want it to be comfortable for input.
i need to code 2 things:
1, when the user is typing in the first field and the space ends, i want the cursor move to the next field.
2. when the user deletes the text in the second field, i want the cursor move to the first field and i don't want the text in the first field to be highlighted.
Copy link to clipboard
Copied
Not possible in a PDF file.
Copy link to clipboard
Copied
setting the cursor to the next field is possible.
setting the cursor the the previous field is possible.
my only problem is making the text not highlighted.
whats not possible?
i'm sure there is something that i can do.
Copy link to clipboard
Copied
Hi.
if the text is marked and the user type a letter the text in the field gets deleted.
how can i prevent that?
The text is not highlighted, it's selected.
So, typing over a selected text remove it, as usual in any software.
Nothing can prevent that since it's by design.
Copy link to clipboard
Copied
there is not way to unselect a field?
Copy link to clipboard
Copied
I'm curious about the answer too.
Copy link to clipboard
Copied
anyone?
Copy link to clipboard
Copied
I don't know of a way.
Copy link to clipboard
Copied
You can't do it directly. You can unselect a field by selecting another one using a script, though.
So just create a dummy field (it can even be hidden) and then set the focus to it.
Copy link to clipboard
Copied
I believe he wants the text field to have the focus, but without all of the text selected, so your initial answer was correct.
Copy link to clipboard
Copied
thanks for all the answers.
its really weird that there is no way to do that.
i guess my customers will have to live without this.
Copy link to clipboard
Copied
It's literally a single key-press. Surely it's not that big a deal...
Find more inspiration, events, and resources on the new Adobe Community
Explore Now