zadof
zadof

Reputation: 69

Example of using multiSelect on a form

Does anybody have a good example on how to use multiSelect field on a form? There is nothing in the documentation about it.

If I add it like any other field I get an error. I am using atk 4.2.

This code:

$f = $form->addField('multiSelect', 'name', 'Caption'); 

will raise this error

Exception_Logic

Method is not defined for this object


Additional information:

class: jUI
method: addPlugin
arguments: Array ( [0] => multiSelect )
.../atk4/lib/BaseException.php:38

Upvotes: 0

Views: 193

Answers (3)

Peter
Peter

Reputation: 728

$f = form->addField('DropDown', 'name','Caption')->setAttr('multiple')->setModel('Application');

But im still searching how to set some of records to be selected...

Upvotes: 0

gsteenss
gsteenss

Reputation: 68

There was a bug in the 'dropdown' Form Field when using setAttr('multiple') which resulted in only returning the last selected value, this has now been resolved by ATK4 developers in github, see: https://github.com/atk4/atk4/pull/233

Upvotes: 1

romaninsh
romaninsh

Reputation: 10664

That's a deprecated field type. You can use default dropdown and add multiselect option with setAttr method.

Upvotes: 0

Related Questions