0
我通過這個製作食譜教程(http://javascriptmvc.com/docs.html# &誰= getstarted)訪問:NAME =「食譜[ '' 名'] inJavascriptMVC
因爲我的工作與運行導軌我改變了輸入名字從名和描述到食譜[「名」]和食譜[「說明」]
保存記錄,通過軌工作正常,但只要JMVC更新它呈現[object object] 01的視圖,而不是標題/描述
控制器:
'form submit': function(el, ev){
ev.preventDefault();
new Cookbook.Models.Recipe(el.formParams()).save();
},
'recipe.created subscribe': function(called, recipe){
$("#recipe tbody").append(this.view("list", {recipes:[recipe]}));
$("#recipe form input[type!=submit]").val(""); //clear old vals
},
形式:
<form>
<div class="field">
<label for="recipe_name">Name</label><br>
<input type="text" size="30" name="recipe[name]" id="recipe_name">
</div>
<div class="field">
<label for="recipe_description">Description</label><br>
<input type="text" size="30" name="recipe[description]" id="recipe_description">
</div>
<input type='submit' value='Create'/>
</form>