Matthew6439702
Posts: 0
Joined: Sun Nov 24, 2013 1:10 am

Calculating Fields

After registering and logging in:
Click on Nutrition button, then on Search USDA Nutrition Data. Search by food Name collapse block should be expanded and I would search, "oats," as it only brings up one entry. A new collapse block list appears with Database result and nutrition data. I left all my fields visible for diagnostic reasons. Under Step 3 myself or client would type in how many servings of food to get the adjust calculations of all empty fields. This all works outside of the collapse block but obviously I can only return one list item and nutrition data values. I am trying to access the seen values of the returned expanded collapse block. In this case it's just 1 item in that list "oats" to make it simple work with. I will limit and cache my list later with pagination. Right now I am lost on how to call tabs within tabs within a data role list. Does this make since?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Calculating Fields

Hello! The problem is that you have a few CollapsBlock after mapping. Try this way prevar $currCollapsBlock = $(this).closest("[name=SelFdCollapseBlock]");
var servinput= $("[dsid=ServingsInput]", $currCollapsBlock);
var num = servinput.val();
var protein = $("[dsid=Protein]", $currCollapsBlock);
var num1 = protein.val();
var prtAdjust = num * num1;
var getval = $("[dsid=prtCalc]", $currCollapsBlock);
getval.val(prtAdjust);/pre

Matthew6439702
Posts: 0
Joined: Sun Nov 24, 2013 1:10 am

Calculating Fields

It worked! Thank you so much! I was on jquery searching for examples on traversal and filtering. Can't tell you how much this helps. Thank you!

Return to “Issues”