Checkbox field in designer not taking value from model field - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Checkbox field in designer not taking value from model field

  • Checkbox field in designer not taking value from model field
  • 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.

  • 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'" />