Note that there are some explanatory texts on larger screens.

plurals
  1. POknockout - Issue in adding user input to table
    primarykey
    data
    text
    <p>This is my html code</p> <pre><code>&lt;tbody data-bind="foreach: awards"&gt; &lt;tr&gt; &lt;td data-bind="text: name"&gt;&lt;/td&gt; &lt;td data-bind="text: email"&gt;&lt;/td&gt; &lt;td data-bind="text: phone"&gt;&lt;/td&gt; &lt;td data-bind="text: address"&gt;&lt;/td&gt; &lt;td &gt;&lt;input type="button" class="btn btn-success pull-centre" value="Update!" /&gt;&lt;/td&gt; &lt;td &gt;&lt;input type="button" class="btn btn-success pull-centre" value="Delete!" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;form class="well form-inline" id="myform" &gt; &lt;div class="form-group"&gt; &lt;label&gt;&lt;b&gt;Form&lt;/b&gt;&lt;/label&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;input type="text" data-bind="value:newName" class="span4" placeholder="Name" id="n" &gt; &lt;/div&gt; &lt;br&gt; &lt;div class="form-group"&gt; &lt;input type="text" data-bind="value:phone" class="span4" placeholder="Phone Number" id="p"&gt; &lt;/div&gt; &lt;br&gt; &lt;div class="form-group"&gt; &lt;input type="text" class="span4" data-bind="value:email" placeholder="Email" id="e"&gt; &lt;/div&gt; &lt;br&gt; &lt;div class="form-group"&gt; &lt;input type="text" class="span4" placeholder="Address" data-bind="value:adrs" id="a"&gt; &lt;/div&gt; &lt;br&gt; &lt;button type="button" class="btn" data-bind="click: showMe"&gt;Find&lt;/button&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <p>this is the javascript + ko bindings</p> <pre><code>function komodel() { var self = this; self.newName = ko.observable(); self.phone = ko.observable(); self.email = ko.observable(); self.adrs = ko.observable(); self.awards = ko.observableArray([{ name: "sohaib", phone: "03009496301", email: "has@yahoo.com", address: "faisal town" }, { name: "pappu", phone: "45609496301", email: "asdhas@yahoo.com", address: "asdasd jinga lala faisal town" }]); self.showMe = function() { self.awards.push({ name: self.newName, phone: self.phone, email: self.email, address: self.adrs }); } } </code></pre> <p>The problem is that although through the new rows are added to the table though form , but when a new row is added, the previous one is over written by it. How do I overcome it ?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload