0
votes

I have created a custom widget in Sitefinity, and I am trying to figure out how I can specify a string to as a long text field. How do I do this? I am using MVC and the latest version of Sitefinity.

This is how the field is specified in my controller:

public string Text { get; set;}

1

1 Answers

1
votes

The field type is correct. You have to modify the designer view and either use <textarea /> or <sf-html-field /> for rich text capability.

For example:

<div class="form-group">
        <label for="description-text">@Html.Resource("Text")</label>
        <textarea id="description-text"
                  class="form-control"
                  rows="3"
                  ng-model="properties.Description.PropertyValue">
        </textarea>
        @*<sf-html-field id="description-text" 
                         class="kendo-content-block" 
                         sf-model="properties.Description.PropertyValue">
         </sf-html-field>*@
</div>

Please note that if you want to use <sf-html-field />, you will want to define it in the components section in DesignerView.json file

If you need a thorough understanding of how Sitefinity is creating its OOTB MVC widgets, have a look at https://github.com/Sitefinity/feather-widgets