Skip to content
Discussion options

You must be logged in to vote

It really depends on the use-case.

  • If you want to dynamically disable them while the form is open, then as @jcastroa87 suggested - you can leverage CrudField JavaScript Library.
  • If you just need to have the fields statically disabled/enabled based on the logged in user role, then you can simply use the disabled attribute for the corresponding fields when defining the fields in setupCreateOperation(), setupUpdateOperation() accordingly following the field attributes guide. As an example
      protected function setupUpdateOperation()
      {
          $attributes = [];
    
          if (!backpack_user()->isSuperAdmin) {
              $attributes = ['disabled' => 'disabled'];
          }
    
          // Repeatable from th…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@shuvoworld
Comment options

Answer selected by shuvoworld
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants