You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: adminforth/documentation/docs/tutorial/03-Customization/02-customFieldRendering.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -239,6 +239,9 @@ Sometimes a custom editor needs to update not only its own field, but also other
239
239
240
240
For this, custom `edit`/`create` components can emit an `update:recordFieldValue` event with the payload `{ fieldName, fieldValue }`. AdminForth will update the corresponding field in the record.
241
241
242
+
> If you emit `update:recordFieldValue` to modify a field which is hidden by `showIn.create:false` / `showIn.edit:false`, the backend will reject the request by default.
243
+
> To allow this, set the target column config to `allowModifyWhenNotShowInCreate:true` and/or `allowModifyWhenNotShowInEdit:true`.
Copy file name to clipboardExpand all lines: adminforth/documentation/docs/tutorial/08-Plugins/05-1-upload-api.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -284,6 +284,9 @@ Sometimes you want to upload a file from one field (custom editor) but store the
284
284
2. Upload from the browser directly to storage.
285
285
3. Emit `update:recordFieldValue` from the custom component with `{ fieldName: pathColumnName, fieldValue: filePath }` so the other field is updated.
286
286
287
+
> Note: if the target UploadPlugin column is hidden on the current page (`showIn.create: false` / `showIn.edit: false`), the backend rejects such updates by default.
288
+
> To allow this, set the target column config to `allowModifyWhenNotShowInCreate: true` and/or `allowModifyWhenNotShowInEdit: true`.
289
+
287
290
This lets you reuse the same Upload plugin instance (and its preview logic) while controlling the UX from a different field.
288
291
289
292
Example Vue custom editor that uploads an avatar and writes the result into another field handled by Upload plugin:
return{error: `Field "${fieldName}" cannot be modified as it is restricted from creation (backendOnly or showIn.create is false, please set it to true)`,ok: false};
1236
+
if(bo){
1237
+
return{
1238
+
error: `Field "${fieldName}" cannot be modified as it is restricted from creation (backendOnly is true).`,
error: `Field "${fieldName}" cannot be modified as it is restricted from creation (showIn.create is false). If you need to set this hidden field during creation, either configure column.fillOnCreate or set column.allowModifyWhenNotShowInCreate = true.`,
return{error: `Field "${fieldName}" cannot be modified as it is restricted from editing (backendOnly or showIn.edit is false, please set it to true)`,ok: false};
1367
+
if(bo){
1368
+
return{
1369
+
error: `Field "${fieldName}" cannot be modified as it is restricted from editing (backendOnly is true).`,
1370
+
ok: false,
1371
+
};
1372
+
}
1373
+
1374
+
if(column.editReadonly){
1375
+
return{
1376
+
error: `Field "${fieldName}" cannot be modified as it is restricted from editing (editReadonly is true).`,
1377
+
ok: false,
1378
+
};
1379
+
}
1380
+
1381
+
if(!shown&&!column.allowModifyWhenNotShowInEdit){
1382
+
return{
1383
+
error: `Field "${fieldName}" cannot be modified as it is restricted from editing (showIn.edit is false). If you need to allow updating this hidden field during editing, set column.allowModifyWhenNotShowInEdit = true.`,
0 commit comments