Make WordPress Core

Changeset 40799


Ignore:
Timestamp:
05/19/2017 05:26:06 PM (7 years ago)
Author:
afercia
Message:

Dashboard: Don't trigger an Events search when the search field is empty.

Fixes #40816.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/dashboard.js

    r40790 r40799  
    235235
    236236            $container.on( 'submit', '.community-events-form', function( event ) {
     237                var location = $.trim( $( '#community-events-location' ).val() );
     238
    237239                event.preventDefault();
    238240
     241                /*
     242                 * Don't trigger a search if the search field is empty or the
     243                 * search term was made of only spaces before being trimmed.
     244                 */
     245                if ( ! location ) {
     246                    return;
     247                }
     248
    239249                app.getEvents({
    240                     location: $( '#community-events-location' ).val()
     250                    location: location
    241251                });
    242252            });
Note: See TracChangeset for help on using the changeset viewer.