Skip to content

Commit 3423c10

Browse files
committed
Fix #77: Support for making the whole form readonly
1 parent 332db1a commit 3423c10

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/form.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ export default class ReactJSONForm extends React.Component {
5252
errorMap: this.props.errorMap || {}
5353
};
5454

55+
if (this.props.readonly)
56+
args.schema.readOnly = true;
57+
5558
if (type === 'array')
5659
return getArrayFormRow(args);
5760
else if (type === 'object')

src/renderer.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export function FormInstance(config) {
1414
this.errorMap = config.errorMap;
1515
this.fileHandler = config.fileHandler;
1616
this.fileHandlerArgs = config.fileHandlerArgs || {};
17+
this.readonly = config.readonly || false;
1718

1819
this.eventListeners = null;
1920

@@ -59,6 +60,7 @@ export function FormInstance(config) {
5960
fileHandler={this.fileHandler}
6061
fileHandlerArgs={this.fileHandlerArgs}
6162
onChange={this.onChange}
63+
readonly={this.readonly}
6264
/>,
6365
document.getElementById(this.containerId)
6466
);
@@ -175,6 +177,7 @@ export class FormContainer extends React.Component {
175177
fileHandler={this.props.fileHandler}
176178
fileHandlerArgs={this.props.fileHandlerArgs}
177179
errorMap={this.props.errorMap}
180+
readonly={this.props.readonly}
178181
/>
179182
);
180183
}

0 commit comments

Comments
 (0)