@@ -11,7 +11,7 @@ export function FormInput({label, help_text, error, inputRef, ...props}) {
1111 if ( inputRef )
1212 props . ref = inputRef ;
1313
14- if ( props . type === 'number' && props . value === null )
14+ if ( props . value === null )
1515 props . value = '' ;
1616
1717 return (
@@ -37,6 +37,9 @@ export function FormCheckInput({label, help_text, error, value, ...props}) {
3737 if ( props . checked === '' || props . checked === null || props . checked === undefined )
3838 props . checked = false
3939
40+ if ( props . readOnly )
41+ props . disabled = true ;
42+
4043 return (
4144 < div >
4245 < label > < input { ...props } /> { label } </ label >
@@ -46,6 +49,9 @@ export function FormCheckInput({label, help_text, error, value, ...props}) {
4649
4750
4851export function FormRadioInput ( { label, help_text, error, value, options, ...props } ) {
52+ if ( props . readOnly )
53+ props . disabled = true ;
54+
4955 return (
5056 < div >
5157 < label > { label } </ label >
@@ -73,6 +79,9 @@ export function FormRadioInput({label, help_text, error, value, options, ...prop
7379
7480
7581export function FormSelectInput ( { label, help_text, error, value, options, ...props } ) {
82+ if ( props . readOnly )
83+ props . disabled = true ;
84+
7685 return (
7786 < div >
7887 { label && < label > { label } </ label > }
@@ -268,6 +277,10 @@ export class FormFileInput extends React.Component {
268277 props . type = 'file' ;
269278 props . onChange = this . handleChange ;
270279
280+ if ( props . readOnly )
281+ props . disabled = true ;
282+
283+
271284 return (
272285 < div >
273286 { label && < label > { label } </ label > }
0 commit comments