Widgets that Post Back

Topics: Customizing Orchard, Writing modules
Jun 30, 2015 at 6:59 AM
Hi All,

We are developing a widget that will trigger updates server side and return the same page with updated details in the widget. We are currently evaluating whether it is necessary to support situations where AJAX is not available (a discussion for another time)

At this stage we expect that the widget will appear on almost every page and return to the current page (content item) after posting.

The best option that we have come up with thus far is setup the widget to post back to itself and to access the form values directly from the request in the Driver, however, this doesn't seem very "orchardy".

Are there other ways to do this that might be more robust?

Thanks in advance,

Jul 6, 2015 at 3:13 PM
You can use a view model specifically for the data that should be posted/displayed by the widget (i.e. you wouldn't - just - use the widget's custom content part as the view model). Then the widget can post to a custom controller where you can update the view model and later redirect to the previous page.