ReactiveVar returning as 0 value

4.4k Views Asked by At

In my /lib/collection.js SimpleSchema. I am using autoValue to return a reactive var value. The console log gives the right value, but the return value shows "0" Please help!

autoValue: function() {
    console.log(ItemCloudIDVar.get()); 
    a = ItemCloudIDVar.get();
    return a;
}
1

There are 1 best solutions below

0
On BEST ANSWER

Solve this, somehow the reactive var was clearing itself every time I submitted the form, cause it to return 0

So what I did was to place in the variable value up front on the frontend form through a helper(ItemCloudIDHelper) instead of through simpleschema backend.

{{> afQuickField name="itemCloudId" value=ItemCloudIDHelper}}