diff --git a/docs/SimpleForm.md b/docs/SimpleForm.md index 99cfe7b9d88..b7384e4a0fa 100644 --- a/docs/SimpleForm.md +++ b/docs/SimpleForm.md @@ -876,7 +876,7 @@ const authProvider = { const ProductEdit = () => ( - + @@ -890,3 +890,28 @@ const ProductEdit = () => ( ); ``` + +Read-only inputs are still included in the data submitted by the form. If you don't want to send these fields to the `dataProvider`, use the `showDisabled` prop instead. Inputs for which users have only `read` access will be displayed but disabled, and omitted from the submitted data: + +```tsx +import { Edit, TextInput } from 'react-admin'; +import { SimpleForm } from '@react-admin/ra-rbac'; + +const ProductEdit = () => ( + + + + + + {/* disabled and not submitted */} + + {/* not displayed */} + + + {/* no delete button */} + + +); +``` + +**Tip:** If both `showReadOnly` and `showDisabled` are set, `showDisabled` takes precedence. \ No newline at end of file diff --git a/docs/TabbedForm.md b/docs/TabbedForm.md index 10a34c0dd0a..7a772445cce 100644 --- a/docs/TabbedForm.md +++ b/docs/TabbedForm.md @@ -1076,4 +1076,36 @@ const ProductEdit = () => ( ); -``` \ No newline at end of file +``` + +Read-only inputs are still included in the data submitted by the form. If you don't want to send these fields to the `dataProvider`, use the `showDisabled` prop instead. Inputs for which users have only `read` access will be displayed but disabled, and omitted from the submitted data: + +```tsx +import { Edit, TextInput } from 'react-admin'; +import { TabbedForm } from '@react-admin/ra-rbac'; + +const ProductEdit = () => ( + + + + + + + {/* Input Description is disabled and not submitted */} + + + {/* Tab Stock is not displayed */} + + + + + {/* Input Image is not displayed */} + + + + + +); +``` + +**Tip:** If both `showReadOnly` and `showDisabled` are set, `showDisabled` takes precedence.