It turns out there's been a #ajax['keypress'] in there forever. It needs to be added to the Form API reference. There also may be code changes that should be added to document this.

CommentFileSizeAuthor
#5 857702.patch1.57 KBjgraham

Issue fork drupal-857702

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

darren oh’s picture

#ajax['keypress'] = TRUE causes the element's #ajax['event'] to be triggered if the Enter key is pressed while the element has focus.

Another important setting is #ajax['trigger_as']. This should contain an array with a 'name' key and an optional 'value' key. This allows non-button elements to submit the form as if a button had been clicked. The 'name' key specifies the button to trigger, and the 'value' key is required if more than one button shares the same name. (Documented in code comments of ajax_process_form().)

rfay’s picture

Assigned: Unassigned » rfay
rfay’s picture

Title: #ajax['keypress'] is undocumented (and #ahah['keypress']) » #ahah['keypress'] is undocumented in D6 FAPI reference

I added #ajax['keypress'] to the D7 FAPI. Review is appreciated, http://api.drupal.org/api/drupal/developer--topics--forms_api_reference....

I'll leave this open because we should copy this to D6, but I'm out of gas for right now.

jhodgdon’s picture

Project: Documentation » Drupal core
Version: » 6.x-dev
Component: New documentation » documentation

Wrong issue queue

jgraham’s picture

StatusFileSize
new1.57 KB

Attached is a patch that covers the D6 details, I assumed they are equivalent to the D7 ajax event of the same name.

#ahah['keypress']

Description: If set to TRUE, then the element's #ahah['event'] will be triggered if the ENTER key is pressed while the element has focus.

rfay’s picture

Status: Active » Reviewed & tested by the community

As far as I can tell, these were in fact the same in D6. Thanks.

jgraham’s picture

Status: Reviewed & tested by the community » Fixed
rfay’s picture

Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.