Node.js - 嵌入的布尔(复选框)字段 Javascript

Node.js - Boolean (Checkbox) Field in Embedded Javascript

I've a boolean field in the model just similar to the below one. And I want to create a view using embedded javascript.   
**settings.js**

module.exports = {

   attributes: {
       myField:{
          type:'boolean',
          defaultsTo:'false'
       }
   }
};

这是我正在使用的代码

 <form action="/settings/create" method="POST" id="sign-up-form" class="form-inline">

     <div class="form-group">
     <label for="field1">my field label</label>
      <input type="checkbox" class="form-control" id="field1" name="myField">
    </div>

    <input type="submit" class="btn btn-primary" value="Create"/>
    <input type="hidden" name="_csrf" value="<%= _csrf %>" />
</form>

所以我面临的问题是

  1. 当我创建记录时,我可以看到 json 中的布尔值设置为 ONOFF 并且为什么这不是 true 或 false?
  2. 还有如何使用嵌入式 javascript
  3. 在视图中呈现 true 或 false
  <div class="form-group">
    <label for="confirmationBox">Field Label</label>
    <% if(object.fieldName==true || object.fieldName=="true"){ %>
    <input type="checkbox" id="confirmationBox" name="confirmationBox" checked>
    <% } else { %>
    <input type="checkbox" id="confirmationBox" name="confirmationBox">
    <% } %>
  </div>