[wp-trac] [WordPress Trac] #11111: HTML stripped from hand-coded select boxes after saving widget options

WordPress Trac wp-trac at lists.automattic.com
Tue Nov 10 03:23:29 UTC 2009


#11111: HTML stripped from hand-coded select boxes after saving widget options
--------------------------+-------------------------------------------------
 Reporter:  sillybean     |       Owner:  azaozz                   
     Type:  defect (bug)  |      Status:  new                      
 Priority:  normal        |   Milestone:  Unassigned               
Component:  Widgets       |     Version:  2.9                      
 Severity:  normal        |    Keywords:  widgets, ajax, javascript
--------------------------+-------------------------------------------------
 I've been having problems with some select boxes in widget options. After
 I save changes, my options are displayed as text rather than option
 fields, like so:
 http://sillybean.net/downloads/widget-before-after.png

 The values are stored correctly, but you can't make any further changes
 without reloading the widget admin page. Select boxes generated by WP
 functions (like `wp_dropdown_categories` or `wp_dropdown_pages`) don't
 seem to be affected, but hand-coded ones are -- although I can't see a
 difference in their HTML structures.

 The ajax return (according to Firebug) looks like:
 {{{
 <p><label for="widget-randompostsfromcategory-3-content">Display:</label>
 <select id="widget-randompostsfromcategory-3-content" name="widget-
 randompostsfromcategory[3][content]" />
   <option value="title" >Title Only</option>
   <option value="excerpt"  selected="selected" >Title and Excerpt</option>
   <option value="content" >Title and Content</option>
 </select></p>
 }}}

 What actually shows up on the page:
 {{{
 <p><label for="widget-randompostsfromcategory-3-content">Display:</label>
 <select name="widget-randompostsfromcategory[3][content]" id="widget-
 randompostsfromcategory-3-content"/>
 Title Only
 Title and Excerpt
 Title and Content
 </p>
 }}}

 For some reason the `</select>` tag is removed along with all the
 `<option></option>` tags.

 The code above is taken from my [http://wordpress.org/extend/plugins
 /random-posts-from-category/ Random Posts from Category plugin], but I've
 seen the same behavior in other widget plugins as well.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11111>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list