[wp-trac] [WordPress Trac] #30951: Customizer: visible values (choices) not correct after setting it through javascript

WordPress Trac noreply at wordpress.org
Mon Jan 11 18:25:05 UTC 2016


#30951: Customizer: visible values (choices) not correct after setting it through
javascript
-----------------------------------------+------------------------------
 Reporter:  katazina                     |       Owner:  westonruter
     Type:  defect (bug)                 |      Status:  assigned
 Priority:  normal                       |   Milestone:  Awaiting Review
Component:  Customize                    |     Version:  4.1
 Severity:  normal                       |  Resolution:
 Keywords:  has-patch reporter-feedback  |     Focuses:  javascript
-----------------------------------------+------------------------------
Changes (by westonruter):

 * keywords:  has-patch => has-patch reporter-feedback


Comment:

 Replying to [comment:7 katazina]:
 > It's maybe, because I called the `sanitize_callback` function with
 `absint`?
 > But I wrote that for radio buttons also, and there string were what
 accepted.

 Looking at the `Element` synchronizer for checkboxes:

 {{{#!js
         api.Element.synchronizer.checkbox = {
                 update: function( to ) {
                         this.element.prop( 'checked', to );
                 },
                 refresh: function() {
                         return this.element.prop( 'checked' );
                 }
         };
 }}}

 Note that it is setting the `checked` property to the Setting's value.
 This means that the checkboxes are explicitly expecting the values to be
 `true` and `false`, not enumerated values. The `radio` button synchronizer
 looks like it will work with enumerated values, however. Isn't a `radio`
 button what you are after anyway?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30951#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list