Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
13d9e0b0
Commit
13d9e0b0
authored
14 years ago
by
Angie Byron
Browse files
Options
Downloads
Patches
Plain Diff
#995122
by threewestwinds, rfay: Allow textareas and textfields to accept spaces in ajax.
parent
2d9916e6
No related branches found
No related tags found
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
misc/ajax.js
+8
-2
8 additions, 2 deletions
misc/ajax.js
with
8 additions
and
2 deletions
misc/ajax.js
+
8
−
2
View file @
13d9e0b0
...
...
@@ -195,13 +195,19 @@ Drupal.ajax = function (base, element, element_settings) {
* The AJAX object will, if instructed, bind to a key press response. This
* will test to see if the key press is valid to trigger this event and
* if it is, trigger it for us and prevent other keypresses from triggering.
* In this case we're handling RETURN and SPACEBAR keypresses (event codes 13
* and 32. RETURN is often used to submit a form when in a textfield, and
* SPACE is often used to activate an element without submitting.
*/
Drupal
.
ajax
.
prototype
.
keypressResponse
=
function
(
element
,
event
)
{
// Create a synonym for this to reduce code confusion.
var
ajax
=
this
;
// Detect enter key and space bar.
if
(
event
.
which
==
13
||
event
.
which
==
32
)
{
// Detect enter key and space bar and allow the standard response for them,
// except for form elements of type 'text' and 'textarea', where the
// spacebar activation causes inappropriate activation if #ajax['keypress'] is
// TRUE. On a text-type widget a space should always be a space.
if
(
event
.
which
==
13
||
(
event
.
which
==
32
&&
element
.
type
!=
'
text
'
&&
element
.
type
!=
'
textarea
'
))
{
$
(
ajax
.
element_settings
.
element
).
trigger
(
ajax
.
element_settings
.
event
);
return
false
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment