More in this section
Forums / Project Feather / Checkbox field in designer not taking value from model field

Checkbox field in designer not taking value from model field

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 0 answered
  1. Ridhi
    Ridhi avatar
    11 posts
    Registered:
    31 May 2016
    27 Feb 2017
    Link to this post

    I have created a custom MVC designer view for my custom MVC widget. The designer has two checkboxes whose value i want to set as true by default from the model fields. There is a input box(String) too whose default value is getting set from the corresponding model field but the checkboxes are not checked when I set the default value to true. 

     

    Designer :  

    <input id="showPhoto" ng-model="properties.showPhoto.PropertyValue" type="checkbox" />

     

     

    Model:

    public Boolean showPhoto;

     

    Controller:

    private Boolean _showPhoto = true;

    public Boolean showPhoto { 
                get
                {
                        return _showPhoto;
                }
                set
                {
                        _showPhoto = value;

                }
                
            }

    Can someone please tell me why the string value gets updated but the checkbox is not getting updated.

  2. Victor Leontyev
    Victor Leontyev avatar
    65 posts
    Registered:
    01 Jul 2014
    28 Feb 2017 in reply to Ridhi
    Link to this post

    Hi Ridhi, you need to use checkbox like that:

    <input id="showPhoto" type="checkbox" ng-model="properties.showPhoto.PropertyValue"
                       ng-true-value="'True'" ng-false-value="'False'" ng-checked="properties.showPhoto.PropertyValue === 'True'" />

     

     

2 posts, 0 answered