0

I want to use the input value with id = "utr_c" in the * place.In 6th line from last.

How is it possible inside a handlebar template file:

{{#each content}}
  {{#if isOddLine}}
    <tr id = {{utr_id}} role="row" class="oddLine">
  {{else}}
    <tr id = {{utr_id}} role="row" class="evenLine">
  {{/if}}
    <td class="data-display-field" style="text-align: left;"><strong>{{creation_date}}</strong></td>
    <td class="data-display-field" style="text-align: right;"><strong>{{shipper_name}}</strong></td>
    <td class="data-display-field" style="text-align: right;"><strong>{{amount.amount_with_penny}}</strong></td>
    <td class="data-display-field" style="text-align: right;">
       <input type = "text"  id="utr_c">
    </td>
    <td class="data-display-field" style="text-align: right;">
    <form action="/disbursements/get_utr_code" method="post">
    <input type="hidden" name="utr_id" value="{{utr_id}}">
    <input type="hidden" name="shipper_name" value ="{{shipper_name}}">
    <input type="hidden" name="biller_id" value ="{{biller_id}}">
    <input type="hidden" name="utrc" value = * >
    <input type="submit" value="Submit UTR" class="btn-style" style="float:right; line-height: 12px; padding: 5px 12px; margin-right: 6px; margin-top: 5px;">
    </form> 
    </td>
    </tr>        
{{/each}}
sb15
  • 313
  • 5
  • 18
  • Why are you are duplicating the same question ? I have seen the same question 3 times in last two days! [here](http://stackoverflow.com/questions/37837450/taking-input-from-inside-handlebar-hbs-file), [here](http://stackoverflow.com/questions/37850038/taking-input-from-inside-handlebar-template-file-hbs) and [here](http://stackoverflow.com/questions/37861042/how-to-use-a-input-value-from-inside-handlebar-hbs-template) – Sandeep Nayak Jun 16 '16 at 14:43
  • First two maybe similar but 3rd one is different.Please look closely before commenting.And please try to give some helpful solution to the question instead of making irrelevant comments. – sb15 Jun 16 '16 at 15:38
  • You should learn to frame the question properly. Otherwise, you may not get any solutions – Sandeep Nayak Jun 17 '16 at 05:23

1 Answers1

1

Try in .js file:

.hbs

<input type="hidden" name="utrc" value = {{{test_name}}} >

.es6

Template({
  ...
  test_name: `"${this.model.test_name}"`
});

Handlebars HTML-escapes values returned by a {{expression}}. If you don't want Handlebars to escape a value, use the "triple-stash", {{{.

According to Handlebars documentation http://handlebarsjs.com/expressions.html

Source of information

Daniel Karski
  • 346
  • 3
  • 13