【发布时间】:2020-08-07 01:54:20
【问题描述】:
在更新节点 js 中的记录时,我能够呈现文本输入字段的值,但在更新表单中,单选按钮和文本区域的值不会出现。任何人都可以让我知道如何实现它。 我正在使用 hbs 模板。
<div class="form-group row">
<label for="inputPassword3" class="col-sm-5 col-form-label" style="color: #2874a6 ;">Owner Name</label>
<div class="col-sm-6">
<input type="email" class="form-control" name="owner" value={{product.owner}}>
</div>
</div>
<div class="form-group row">
<label for="inputPassword3" class="col-sm-5 col-form-label" style="color: #2874a6 ;">Description</label>
<div class="col-sm-6">
<textarea class="form-control" name="description" rows="2" value={{product.description}}></textarea>
</div>
</div>
<div class="form-group row">
<label for="inputPassword3" class="col-sm-5 col-form-label" style="color: #2874a6 ;">Summary column format</label>
<div class="col-sm-6">
<div class="radio-inline">
<input class="form-check-input" type="radio" name="taskDone" value="Yes" onClick="changeresult();">if({{product.team}}=="Yes"){ %> checked
<%} %>> Yes </input>
</div>
<div class="radio-inline">
<input class="form-check-input" type="radio" name="taskDone" value="No" onClick="changeresult();">if({{product.taskDone}}=="Yes"){ %> checked
<%} %>> Yes </input>
</div>
</div>
</div>
textarea 字段和单选按钮的值未出现。 提前感谢您的帮助
【问题讨论】:
-
您确定您正确使用了帮助程序吗? The docs suggest 一种看起来更像这样的方法:
{{#if product.team == "Yes"}} checked {{/if}}。您的示例看起来更像EJS而不是handlebars。我对车把只略知一二,但在阅读文档一段时间后,这是一个最好的猜测。 -
我根据你的建议编辑了我的代码 Yes 但在第 125 行出现错误解析错误:..." {{#if ticket.team == “是”}} 检查 { -----------------------^ 期待 'CLOSE_RAW_BLOCK'、'CLOSE'、'CLOSE_UNESCAPED'、'OPEN_SEXPR'、'CLOSE_SEXPR ','ID','OPEN_BLOCK_PARAMS','STRING','NUMBER','BOOLEAN','UNDEFINED','NULL','DATA','SEP',得到'EQUALS'
标签: javascript mysql node.js express handlebars.js