AutoForms -- Default values for current time?

	type: String,
	autoform: {

Loving autoforms, however, I’m stuck – this code here gives me the current time of for creation. And I don’t want a client side hack to insert time. That is, if I let this form sit for 5 minutes and then submit it, it submits 5 minutes ago instead of now.

Anyone know what to do?

You’ll want to use an autoValue function at the schema level with the return value wrapped in an if (this.isInsert) and the fields denyUpdate set to true.

Have a look at the createdAt field definition of any of the socialize packages for inspiration.

1 Like