Skip to content
Discussion options

You must be logged in to vote

To achieve the dynamic hiding of fields on the Backpack CRUD edit page based on switch selection, you can use the CrudField JavaScript API provided by Backpack. Here's how you can modify your code to implement this functionality:

protected function setupUpdateOperation()
{
    $this->setupCreateOperation();
    
    CRUD::addField([
        'name' => 'visible_for_new_version',
        'type' => 'switch',
        'label' => 'Visible for New Version',
    ]);
    
    CRUD::addField([
        'name' => 'visible_for_old_version',
        'type' => 'switch',
        'label' => 'Visible for Old Version',
    ]);

    // Add custom JavaScript to manage field visibility
    CRUD::addField([
    …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by avinashtelsa
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants