Multiple select2

  • Pippo Poppo
    Participant
      # 2 weeks, 6 days ago

      Hi,

      Hi, the multiple selection of the values of some select-boxes is possible?.
      Here an example. How can I make it a multiple choice of its values?
      Thank you

      ‘tax_and_currency’ => [

      ‘tax_id’ => [
      ‘type’ => ‘manyToOne’,
      ‘relation’ => ‘tax’,
      ‘column’ => ‘name’,
      ‘col-class’ => ‘col-lg-4 col-md-4 col-sm-6’,
      ‘dont_translate’ => true,
      ],

    • laravel-bap
      Keymaster
        # 2 weeks, 5 days ago

        Hi,

        just add ‘multiple’ => true

        $this->add(‘roles’, ‘choice’, [
        ‘choices’ => $roles,
        ‘attr’ => [‘class’ => ‘select2 pmd-select2 form-control’],
        ‘selected’ => $this->model ? $this->model->roles()->pluck(‘name’)->toArray() : null ,
        ‘expanded’ => false,
        ‘multiple’ => true
        ]);


        remember that you will need to implement relation one to many or many to many.

      • Asif Ba
        Participant
          # 2 weeks, 5 days ago

          This is working with normal forms. However, in ‘modals’ I am unable to do keyboard inputs to select from the list.

        • laravel-bap
          Keymaster
            # 2 weeks, 3 days ago

            I checked this on new version (not yet published) and there is no issue. I don’t think i changed anything in this place. Below my setting. I use CTRL to select multiple records from dropdown.

          You must be logged in to reply to this topic.