Disable creation/deletion for relationship (repeatable) fields #495
-
Is it possible to disable or hide the "delete" and "new item" buttons on a relationship/repeatable field? I really just want these items to be visible, but without the ability to add/remove them. Disabling the individual subfields is simple enough, but the readonly and disabled attributes don't have an effect at the upper widget level.
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Hi, @cj-fbr can you give us more information? maybe you can add what the forms look like, so we can understand what's going on, is it in an update operation? |
Beta Was this translation helpful? Give feedback.
-
@cj-fbr You can disable the whole repeatable using the CRUD JS API.
But if you want to ensure your field is not saved (even if user modify html attributes), you should overwrite the Alternatively you can use a FormRequest and exclude that field from the request after validation. Cheers |
Beta Was this translation helpful? Give feedback.
-
I'm closing this issue due to inactivity. If you need further assistance or have additional questions, feel free to reopen this issue or create a new one. We're here to help! |
Beta Was this translation helpful? Give feedback.
@cj-fbr You can disable the whole repeatable using the CRUD JS API.
crud.field('things').disable()
(you can test it in the browser console and then move it to a file if it does what you want).But if you want to ensure your field is not saved (even if user modify html attributes), you should overwrite the
store()
orupdate()
functions and remove it from the request.Alternatively you can use a FormRequest and exclude that field from the request after validation.
Cheers