[wp-trac] [WordPress Trac] #39770: Customize: Client-side notification error is unexpectedly cleared when no corresponding server-side validation

WordPress Trac noreply at wordpress.org
Thu Feb 2 19:55:07 UTC 2017


#39770: Customize: Client-side notification error is unexpectedly cleared when no
corresponding server-side validation
--------------------------+-------------------
 Reporter:  westonruter   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  4.7.3
Component:  Customize     |    Version:  4.6
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-------------------
 Setting validation can be added both by adding a `validate_callback` (or
 `sanitize_callback`) on the server, or it can be added by adding an error
 `Notification` via JS (see also
 [https://make.wordpress.org/core/2016/07/05/customizer-apis-in-4-6-for-
 setting-validation-and-notifications/ Make/Core post]):

 {{{#!js
 wp.customize( 'blogdescription', function( setting ) {
         var errorCode = 'capital_P_dangit';
         setting.bind( function( value ) {
                 var notification;
                 if ( /[Ww]ordpress/.test( value ) ) {
                         notification = new wp.customize.Notification(
                                 errorCode,
                                 {
                                         type: 'error',
                                         message: 'Capital P Dangit!'
                                 }
                         );
                         setting.notifications.add( errorCode, notification
 );
                 } else {
                         setting.notifications.remove( errorCode );
                 }
         } );
 } );
 }}}

 However, if the server lacks corresponding validation (which normally it
 should) the setting is currently marked as valid on the server and the
 `error` gets unexpectedly cleared on the client.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39770>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list