Checkbox field in designer not taking value from model field

Posted by Community Admin on 05-Aug-2018 18:51

Checkbox field in designer not taking value from model field

All Replies

Posted by Community Admin on 27-Feb-2017 00:00

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.

Posted by Community Admin on 28-Feb-2017 00:00

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

 

 

This thread is closed