Meteor - Get a Session value into input value in template -



Meteor - Get a Session value into input value in template -

i have helper template changes appearance of input field when it's selected item in template. want utilize same template either tell input field not selected or pass session value if is.

here template:

<template name="income"> {{#each accounts}} <tr> <td class="row1"><input type="text" maxlength="58" value="{{income_acct_name}}" id="income_acct_name{{_id}}"></td> {{#if selectedacct }} <td class="row4" align="right"><input type="text" size="13" value="{{amount}}" id="income_amt_entered{{_id}}" class="open" readonly></td> {{else}} <td class="row4" align="right"><input type="text" size="13" value="" id="income_amt_entered{{_id}}" disabled></td> {{/if}} <td class="row5" align="right">{{formatmoney income_acct_total}}</td> </tr> {{/each}} </template>

here helper:

template.income.selectedacct= function(){ var amount = ""; var selectedacct = session.get('selectedacct'); var thisacct = "income_amt_entered" + this._id; if (thisacct == selectedacct) { homecoming {amount: session.get('amount')}; } else { homecoming false; } };

i tried wrap {{#with selectedacct}} seek insert {{amount}} ever other helper template started throwing errors because can no longer see id of input element-

{{#with selectedacct}} <td class="row4" align="right"><input type="text" size="13" value="{{amount}}" id="income_amt_entered{{_id}}" class="open" readonly></td> {{/with}} typeerror: cannot read property 'type' of null

is there way pass value template.income.selectedacct or need go different way?

templates meteor

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -