1-888-365-2779
+1-888-365-2779
Try Now
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

2 posts, 0 answered
  1. Ridhi
    Ridhi avatar
    11 posts
    Registered:
    31 May 2016
    27 Feb
    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 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