Dashboard: Don't trigger an Events search when the search field is empty.
Fixes #40816. git-svn-id: https://develop.svn.wordpress.org/trunk@40799 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
cc214db09f
commit
99dde26730
@ -234,10 +234,20 @@ jQuery( function( $ ) {
|
|||||||
$container.on( 'click', '.community-events-toggle-location, .community-events-cancel', app.toggleLocationForm );
|
$container.on( 'click', '.community-events-toggle-location, .community-events-cancel', app.toggleLocationForm );
|
||||||
|
|
||||||
$container.on( 'submit', '.community-events-form', function( event ) {
|
$container.on( 'submit', '.community-events-form', function( event ) {
|
||||||
|
var location = $.trim( $( '#community-events-location' ).val() );
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Don't trigger a search if the search field is empty or the
|
||||||
|
* search term was made of only spaces before being trimmed.
|
||||||
|
*/
|
||||||
|
if ( ! location ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
app.getEvents({
|
app.getEvents({
|
||||||
location: $( '#community-events-location' ).val()
|
location: location
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user