Autoform stops working when using a submit event listener


#1

I have the following form:

  {{#autoForm schema="liftSchema" id="submitOfferLift" type="method"}}
      {{> afQuickField name="destination"}}
      <input id="dateasdf" type="text" class="form-control datepicker">
      <\button type="submit" class="btn btn-primary">Offer lift</button>
  {{/autoForm}}

I want to use a datepicker inside, so I can’t use meteormethod="offerLift" in the autoform options because the JSON object sent to the server doesn’t pick up that input field. Therefore, I must use an event listener to listen for the button submit. However, when I implement the submit code for the button, I get an error: Error: liftSchema is not in the window scope meteor.js:880:11 and the page doesn’t render. If I take out the code

Template.AppOfferLift.events({
“submit”: function (event) {
…}

then the form renders just fine, but is useless since I can’t submit. Is this a bug? And how can I work around this?


#2

what is stopping you from using datepicker for autoform input ?
you can make your own template for any autoform input you want.