Skip to content

Commit 085364c

Browse files
committed
Update addSubmit option (now true / false / ‘auto’) to allow hiding submit button on automatically generated forms.
1 parent 6561a87 commit 085364c

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular2-json-schema-form",
3-
"version": "0.3.0-alpha.12",
3+
"version": "0.3.0-alpha.13",
44
"author": {
55
"name": "dschnelldavis",
66
"email": "[email protected]"

src/library/json-schema-form.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ export class JsonSchemaFormComponent implements DoCheck, OnChanges, OnInit {
237237
} else if (this.form && isArray(this.form.layout)) {
238238
this.jsf.layout = this.form.layout;
239239
} else {
240-
this.jsf.layout = [ '*', { type: 'submit', title: 'Submit' } ];
240+
this.jsf.layout = this.jsf.globalOptions.addSubmit === false ?
241+
[ '*' ] : [ '*', { type: 'submit', title: 'Submit' } ];
241242
}
242243

243244
// Import alternate layout formats 'UISchema' or 'customFormItems'

src/library/json-schema-form.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ export class JsonSchemaFormService {
5050

5151
// Default global form options
5252
public globalOptions: any = {
53-
// addSubmit: false, // Add a submit button if layout does not have one?
53+
addSubmit: 'auto', // Add a submit button if layout does not have one?
54+
// true = always, false = never, 'auto' = only if layout is undefined
5455
// debug: false, // Show debugging output?
5556
// fieldsRequired: false, // Are there any required fields in the form?
5657
// framework: 'bootstrap-3', // Display formating framework to use

0 commit comments

Comments
 (0)