Q: Meteor changing form value upon page load I'm trying to change the values of some input fields only once upon page being loaded. For example submit_date_year should be current year, so 2017 right now.
My HTML
<template name="trip_html">

<table class="table table-striped table-condensed table-hover rsk-tbl vScrollTHead">
<tr>
      <td><input class="form-control input-lg" name="submit_date_day" type="text" placeholder="Day"/>  </td>
       <td><input class="form-control input-lg" name="submit_date_month" type="text" placeholder="Month"/>  </td>
        <td><input class="form-control input-lg" name="submit_date_year" type="text" placeholder="Year"/>  </td>
    </tr>
    </table>
</template>

My JS
On page load function
Template.trip_html.rendered = function(event, template) {

     event.target.submit_date_year.value = 'test'; // DOES NOT WORK
      console.log('Template onLoad');

};

However, I cannot use event.target.submit_date_year in that on load function, for some reason...
But it works in events, once I click 'submit' button
Template.trip_html.events({
"submit .add-trip": function(event){
event.preventDefault();
var day = event.target.submit_date_day.value;
var month = event.target.submit_date_month.value;


var year = event.target.submit_date_year.value;

var car = event.target.submit_car.value;
var b = event.target.submit_b.value;
var a = event.target.submit_a.value;
var dist = event.target.submit_dist.value;

if(empty(day) || empty(month) || empty(year) || empty(car) || empty(b) || empty(a) || empty(dist)){
return false;
}

if(!isNumeric(day) || !isNumeric(month) || !isNumeric(year) || !isNumeric(dist)){
    return false;
}

if(day.startsWith("0"))
day = day.replace("0", "");

if(month.startsWith("0"))
month = month.replace("0", "");

if(year.startsWith("0"))
year = year.replace("0", "");

console.log(day, month, year, car, a, b, dist);
Meteor.call('addTrip', day, month, year, car, a, b, dist);

event.target.submit_a.value = event.target.submit_b.value;
event.target.submit_b.value = '';
event.target.submit_dist.value = '';


},

Help please!

A: It does not work because you are passing an event parameter in the onRendered Callback. Therefore, you can't select the DOM element via event.target.
try to give the element a certain class in the markup and replace the line event.target.submit_date_year.value = 'test'; // DOES NOT WORK
with something like:
$('.year-input').val() = 'test';

The html line:
<td><input class="form-control input-lg year-input" name="submit_date_year" type="text" placeholder="Year"/></td>

You can delete the 'event' parameter from the rendered callback now.
Hope, I could help.

A: The reason it isn't working is because you aren't using the onRendered function properly. You are also trying to access the input using an event object which doesn't exist because there is no event.
Try:
Template.trip_html.onRendered(function () {
  $('input[name="submit_date_year"]').val('2017');
});

EDIT
You can just use HTML to achieve this too if you don't need the data to be dynamic. 
<input class="form-control input-lg" name="submit_date_year" type="text" placeholder="Year" value="2017"/>

