Skip to content

Commit 61ec125

Browse files
authored
Merge pull request #33 from jankapunkt/master
Workaround for "Exception in template helper: idStringify after update to newest core package versions"
2 parents 208a46c + a275560 commit 61ec125

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Schemas.Posts = new SimpleSchema({
6767
afFieldInput: {
6868
type: 'fileUpload',
6969
collection: 'Images',
70-
uploadTemplate: 'uploadField' // <- Optional
70+
uploadTemplate: 'uploadField', // <- Optional
7171
previewTemplate: 'uploadPreview' // <- Optional
7272
}
7373
}
@@ -84,9 +84,9 @@ Generate the form with `{{> quickform}}` or `{{#autoform}}` e.g.:
8484
##### Insert mode:
8585

8686
```html
87-
{{> quickForm collection="Posts" type="insert"}}
87+
{{> quickForm id="postsInsertForm" collection="Posts" type="insert"}}
8888
<!-- OR -->
89-
{{#autoForm collection="Posts" type="insert"}}
89+
{{#autoForm id="postsInsertForm" collection="Posts" type="insert"}}
9090
{{> afQuickField name="title"}}
9191
{{> afQuickField name="picture"}}
9292
<button type="submit" class="btn btn-primary">Insert</button>
@@ -97,11 +97,11 @@ Generate the form with `{{> quickform}}` or `{{#autoform}}` e.g.:
9797

9898
```html
9999
{{#if Template.subscriptionsReady }}
100-
{{> quickForm collection="Posts" type="update" doc=getPost}}
100+
{{> quickForm id="postsUpdateForm" collection="Posts" type="update" doc=getPost}}
101101
{{/if}}
102102
<!-- OR -->
103103
{{#if Template.subscriptionsReady }}
104-
{{#autoForm collection="Posts" type="update" doc=getPost}}
104+
{{#autoForm id="postsUpdateForm" collection="Posts" type="update" doc=getPost}}
105105
{{> afQuickField name="title"}}
106106
{{> afQuickField name="picture"}}
107107
<button type="submit" class="btn btn-primary">Update</button>

lib/client/fileUpload.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ Template.afFileUpload.helpers({
4848
},
4949
uploadedFile() {
5050
const template = Template.instance();
51-
return template.collection.findOne({
52-
_id: template.fileId.get() || this.value
53-
});
51+
var _id = template.fileId.get() || this.value;
52+
if (typeof _id !== 'string' || _id.length === 0) return null;
53+
return template.collection.findOne({_id:_id});
5454
}
5555
});
5656

package.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Package.describe({
22
name: 'ostrio:autoform-files',
33
summary: 'File upload for AutoForm using ostrio:files',
44
description: 'File upload for AutoForm using ostrio:files',
5-
version: '2.0.2',
5+
version: '2.0.3',
66
git: 'https://github.com/VeliovGroup/meteor-autoform-file.git'
77
});
88

0 commit comments

Comments
 (0)