Autoform hook does not work


#1

I have created a created a template with school.html,school.css and school.js files.

This is what i have in my school.js file

AutoForm.hooks({
  usercreation:{
    onSubmit: function(event) {
      event.preventDefault();
      console.log('hi');
  }
  }
})

/******************************************/
/* Schools: Event Handlers */
/******************************************/
Template.Schools.events({ 
//more code 

and this is my html

{{ #autoForm schema="Schema.User" class="uc" id="usercreation" collection ="Meteor.users" type="method" meteormethod="usercreation" }}
                                    <fieldset>
                                      <legend>Create an account</legend>
                                      {{> afQuickField name='email' label='Email' }}
                                      {{> afQuickField name='password' type="password" label='Password'  }}
                                      {{> afQuickField name='profile.schoolname' label='School Name' }}
                                      {{> afQuickField name='profile.schooldescription' label='School Description' }}
                                      {{> afQuickField name='profile.schoollocation' label='School Location' }}
                                      {{> afQuickField name='profile.schoollogo' label='School Logo' }}
                                      {{> afQuickField name='profile.schooltelephonenumber' label='School Telephone Number' }}
                                      
                                    </fieldset>
                                    <input type="submit">
                                  {{ /autoForm }}

I am able to display the form with the submit button. Why is the hook not working?.


#2

AutoForm onSubmit hooks are only called when type is normal. See: AutoForm Docs - Form Types: normal.


#3

Let me have a look and report what i found.


#4

@hwillson I solved the issue and created a gist here https://gist.github.com/openqubit/12ebcce5f91228e2a295b8ff0327512b