Autoform doesn't submit


#1

I’m trying to insert into my collection with autoform, but the form will not submit. I have turned on AutoForm.debug = true and have no output

Hook:

	confirmPurchaseOrder:
		onSubmit: (insertDoc, updateDoc, currentDoc) ->
			console.log arguments
		onError: (name, error, template) ->
  		console.log name + ' error:', error

Template:

{{#autoForm collection="purchaseOrders" type="insert" id="confirmPurchaseOrder"}}
                          {{> afQuickField name="message" rows=4 type="textarea" style="width: 100%;"}}
                          {{> afQuickField name="orders" value=orders type="hidden"}}
                          {{> afQuickField name="status" value='open' type="hidden"}}
                          <button type="button" class="btn btn-success" id="confirmOrderFinal">Confirm Order</button>
                       {{/autoForm}}

Collection:

Schemas.purchaseOrders = new SimpleSchema
  message:
    type: String
    label: "Extra message or instructions"
    autoform:
      afFieldInput:
        type: "textarea"
        rows: 4

	status:
		type: String
		allowedValues: [
    'open'
    'completed'
  	]
		defaultValue: 'open'

	orders:
		type: Array

	createdAt:
		type: Date
		autoValue: ->
			if this.isInsert
				new Date()

	updatedAt:
		type:Date
		optional:true
		autoValue: ->
			if this.isUpdate
				new Date()

	owner:
		type: String
		regEx: SimpleSchema.RegEx.Id
		autoValue: ->
			if this.isInsert
				Meteor.userId()
		autoform:
			options: ->
				_.map Meteor.users.find().fetch(), (user)->
					label: user.emails[0].address
					value: user._id

Any help much appreciated in how to debug this issue with the form not saving, thanks


#2

Have found the problem - submit button is not defined as button type=“submit” the form is now submitted :slight_smile: