Is there an event for a field so that they can click the "enter" key and have the form submitted?
Solved! Go to Solution.
Views
Replies
Total Likes
You can test the xfa.event.commitKey on the exit event of the field. It will return a value of 2 if the user hit enter or a value of 3 if they hit tab.
Paul
Views
Replies
Total Likes
Sure ...a button field exhibits that behaviour.
Paul
Views
Replies
Total Likes
Paul, that's not what I'm talking about... The first part of our form is
a search interface - so a user can enter a last name and hit the enter key
- and if so, I want the search to be executed. Right now they havce to
click a button to execute the search. I'd also like the enter key to
simulate the same thing. Any suggestions?
Views
Replies
Total Likes
By default the enter key will give you a new line on a multi-line field. If you are in a single line field the enter key will exit the field, so you could execute your code on the exit event of the field.
Paul
Views
Replies
Total Likes
Interesting, thanks. - the field is a single line text field. Tabbing
out of the field takes me to the next field, but hitting the enter key
makes the cursor go away and does not position to the next field. Although
the exit event is still fired. Cool for now, thanks.
Views
Replies
Total Likes
Actually, I cannot execute my code on the exit event of the field, because
a user should be able to tab out of the field without executing the code,
but should be able to "enter" within the field to execute. Both the tab
and the enter execute the exit event. So the exit event won't work in
this case.... I wonder if I can check on the exit event whether they hit
the tab key or the enter key?
thanks
Views
Replies
Total Likes
You can test the xfa.event.commitKey on the exit event of the field. It will return a value of 2 if the user hit enter or a value of 3 if they hit tab.
Paul
Views
Replies
Total Likes
Could you not also check for no data in the field and not execute the search if nothing is entered?
Views
Replies
Total Likes
not really ,because they will be entering data. For example, they can
enter a last name, then tab to the zip code field, enter data, and hit
enter (at which point the search should execute based off the contents of
the last name and zip code fields), or, more simply, they may just want to
enter a last name and hit enter, and not further refine by zip code.
That's just one of three different search methods we are offering.
thanks,
elaine
Views
Replies
Total Likes
Is the commitKey approach not acceptable?
Paul
Views
Replies
Total Likes
It most certainly is, Paul. I was just answering Jono's question.
Thanks,
Elaine
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies