[wp-trac] [WordPress Trac] #9703: widget save procedure is
inconsistent with js on and off
WordPress Trac
wp-trac at lists.automattic.com
Sat May 2 15:51:08 GMT 2009
#9703: widget save procedure is inconsistent with js on and off
-------------------------------+--------------------------------------------
Reporter: Denis-de-Bernardy | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: 2.8
Component: Widgets | Version: 2.8
Severity: major | Keywords:
-------------------------------+--------------------------------------------
I'm getting this awkward bug as I seek to debug a nav menu widget.
It's passing a variable length array to the update handler in order to
fill it with items. The various field names are as follows:
{{{
name="' . $this->get_field_name('items') . '[type][]"
}}}
When saving using no js, everything works as expected. The js save
procedure, however, is completely broken.
The $_POST sent to admin-ajax.php is the following:
{{{
array(11) {
["action"]=>
string(11) "save-widget"
["savewidgets"]=>
string(10) "5e80c3f1ef"
["sidebar"]=>
string(11) "top_sidebar"
["widget-nav_menu"]=>
array(1) {
[3]=>
array(3) {
["title"]=>
string(6) "Browse"
["dropdown"]=>
string(3) "url"
["items"]=>
array(3) {
["label"]=>
array(1) {
[0]=>
string(7) "Section"
}
["type"]=>
array(1) {
[0]=>
string(4) "page"
}
["ref"]=>
array(1) {
[0]=>
string(1) "8"
}
}
}
}
["widget-id"]=>
string(10) "nav_menu-3"
["id_base"]=>
string(8) "nav_menu"
["widget-width"]=>
string(3) "330"
["widget-height"]=>
string(3) "200"
["widget_number"]=>
string(1) "3"
["multi_number"]=>
string(0) ""
["add_new"]=>
string(0) ""
}
}}}
The data received without js, for the same data, is different:
{{{
array(11) {
["action"]=>
string(11) "save-widget"
["savewidgets"]=>
string(10) "5e80c3f1ef"
["sidebar"]=>
string(11) "top_sidebar"
["widget-nav_menu"]=>
array(1) {
[3]=>
array(3) {
["title"]=>
string(6) "Browse"
["dropdown"]=>
string(3) "url"
["items"]=>
array(3) {
["label"]=>
array(1) {
[0]=>
string(4) "Home",
[1]=>
string(7) "Section"
}
["type"]=>
array(1) {
[0]=>
string(4) "home",
[1]=>
string(4) "page"
}
["ref"]=>
array(1) {
[0]=>
string(4) "home",
[1]=>
string(1) "8"
}
}
}
}
["widget-id"]=>
string(10) "nav_menu-3"
["id_base"]=>
string(8) "nav_menu"
["widget-width"]=>
string(3) "330"
["widget-height"]=>
string(3) "200"
["widget_number"]=>
string(1) "3"
["multi_number"]=>
string(0) ""
["add_new"]=>
string(0) ""
}
}}}
Something clearly wrong is occurring over in widgets.js's save procedure,
but my script-foo and jQuery-foo is a little too weak to fix it. Pointers
(or a straight patch from Andrew) would be most welcome.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/9703>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list