mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Menus: Remove error styling when the user addresses the error.
An error is triggered if a Menu Name isn't given when the user attempts to create a menu. When they go back and add a name, the error styling can be removed. Props ashokrd2013, piyush9100, welcher, afercia. Fixes #42321. git-svn-id: https://develop.svn.wordpress.org/trunk@44680 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -835,6 +835,20 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$( '#menu-name' ).on( 'input', _.debounce( function () {
|
||||
var menuName = $( document.getElementById( 'menu-name' ) ),
|
||||
menuNameVal = menuName.val();
|
||||
|
||||
if ( ! menuNameVal || ! menuNameVal.replace( /\s+/, '' ) ) {
|
||||
// Add warning for invalid menu name.
|
||||
menuName.parent().addClass( 'form-invalid' );
|
||||
} else {
|
||||
// Remove warning for valid menu name.
|
||||
menuName.parent().removeClass( 'form-invalid' );
|
||||
}
|
||||
}, 500 ) );
|
||||
|
||||
$('#add-custom-links input[type="text"]').keypress(function(e){
|
||||
$('#customlinkdiv').removeClass('form-invalid');
|
||||
|
||||
@@ -1166,8 +1180,8 @@
|
||||
menuName = $('#menu-name'),
|
||||
menuNameVal = menuName.val();
|
||||
// Cancel and warn if invalid menu name
|
||||
if( !menuNameVal || menuNameVal == menuName.attr('title') || !menuNameVal.replace(/\s+/, '') ) {
|
||||
menuName.parent().addClass('form-invalid');
|
||||
if ( ! menuNameVal || ! menuNameVal.replace( /\s+/, '' ) ) {
|
||||
menuName.parent().addClass( 'form-invalid' );
|
||||
return false;
|
||||
}
|
||||
// Copy menu theme locations
|
||||
|
||||
Reference in New Issue
Block a user