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:
- Go to the Widgets page in admin
- Ensure "Default" is the active layer
- Press "Add" button in the "Content" zone to create a new widget, and select the "HTML Widget"
- Change the "Layer" drop-down list from "Default" to "TheHomepage"
- Give the new widget a name and some body content, then save the new widget.
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.
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.