Opened 15 years ago
Closed 15 years ago
#11111 closed defect (bug) (invalid)
HTML stripped from hand-coded select boxes after saving widget options
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.9 |
Component: | Widgets | Keywords: | widgets, ajax, javascript |
Focuses: | Cc: |
Description
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 Random Posts from Category plugin, but I've seen the same behavior in other widget plugins as well.
Change History (5)
#3
@
15 years ago
- Resolution invalid deleted
- Status changed from closed to reopened
Reopening because I have never seen documentation indicating that form elements in widget options screens must be escaped. (Text, yes; form elements themselves, no.) My code looks exactly like that of the native widgets, but the select/option form fields are nevertheless incorrectly stripped.
Are you sure you're using the right escape function?
Reopen if you can reproduce the error with a native widget.