This project is read-only.


Creating new widget ignores chosen layer


When creating a new widget, the widget is always added to the layer that was active on the main widget page, and the value chosen in the "Layer" drop-down list is ignored (if changed).

Orchard Version: 1.6

Steps To Reproduce:
  1. Go to the Widgets page in admin
  2. Ensure "Default" is the active layer
  3. Press "Add" button in the "Content" zone to create a new widget, and select the "HTML Widget"
  4. Change the "Layer" drop-down list from "Default" to "TheHomepage"
  5. Give the new widget a name and some body content, then save the new widget.
  6. Upon being returned to the main Widget page, observe that the new widget has been added to the "Default" layer rather than the "TheHomepage" layer.
Root Cause:

This is occurs because the current layerId (and zone) are passed through to the AddWidget action via url parameters, and thus are included in the form's action as url parameters.

When the form is posted, the layerId parameter in the form's action is taking precedence over the WidgetPart.LayerId field value from the form (in the POST data).

The fix is to add a binding hint to the layerId parameter in the controller's AddWidget post action (similarly to the binding hint that already exists on the EditWidget post action.


mjy78 wrote Nov 14, 2012 at 10:14 PM

Jetski5822 wrote Jun 7, 2013 at 11:54 PM

Fixed in changeset 1cce53194eb0

sfmskywalker wrote Mar 28, 2014 at 1:28 AM

Fixed in changeset cd125b2e869a1f1520a383220fb8ed7249e17ef6