Search code examples
c#sitefinitysitefinity-mvcsitefinity-10

Sitefinity Widget Designer not saving values


Created a custom widget in Sitefinity MVC, with a custom widget designer:

<div class="form-group">
    <label for="My Field">My Field</label>
    <div class="row">
        <div class="col-xs-3">
            <input type="text" sf-model="properties.MyField.PropertyValue" class="form-control" id="MyField" />
        </div>
    </div>
</div>

Defined in both the controller and the model:

public string MyField { get; set; }

When I click edit, the field shows up as expected. I click save, and then hit edit again: value not stored. Does not help to refresh the page, and is not showing up in the widget itself either.

Am I missing a piece? The documentation is a little long-winded and scattered, I've been scouring through it but nothing is jumping out at me.


I see a put request sent in dev tools, but the request payload is empty. Not sure if this is the right request or relevant.


Solution

  • sf-model should be ng-model

    <div class="form-group">
        <label for="My Field">My Field</label>
        <div class="row">
            <div class="col-xs-3">
                <input type="text" ng-model="properties.MyField.PropertyValue" class="form-control" id="MyField" />
            </div>
        </div>
    </div>