So im making this inventory website, so the forklift drivers can add or remove weight from our inventory we measure our products in weight.
So basically I need to be able to fetch the weight (in kg) from mongo db and add it to it and save it
//edit the problem I'm having is the current code is returning "NaN kg" in html
kg is defined by a number inserted into the db and i cant seem to get the kg value without my code running into a error
The Html
<form class="add-pro">
<input type="text" class="form-control" name="namn" required="true" placeholder="Produkt Name"/>
<br />
<input type="text" class="form-control" name="id" required="true" placeholder="Produkt code"/>
<br />
<input type="number" class="form-control" placeholder="KG" name="kg" />
<input id="btnModal" type="submit" value="add" class="btn btn-primary"/>
</form>
<form class="add-data">
<input type="number" class="form-control" id="add-data-control" name="g" placeholder="how much">
<button class="glyphicon glyphicon-plus" type="submit" id="add-data-plus" aria-hidden="true"></button>
</form>
Javascript
"submit .add-data": function(event){
var g = event.target.g.value;
var x = produkter.find().fetch();
var k = kg;
produkter.update(this._id, {$set: {kg: +k + +g }});
},
Template.produkter.events({
"submit .add-pro": function(event){
var namn = event.target.namn.value;
var id = event.target.id.value;
var kg = event.target.kg.value;
produkter.insert({
namn: namn,
id: id,
kg: kg
});
return false;
},

