I've tried using your code on my system but even getValues()
will always only return me the first value in a multivalue text field. setValues()
will only work if I pass a single value or an array with exactly one value; all other scenario's don't set any fields in the GUI.
Based on that I believe you would have to use the Anguilla framework to manipulate your field values; the previously mentioned cookbook has examples for field manipulations.
Edit: further inquiry into the nature of the getValues and setValues functions (sourcecode ftw) has lead me to the following solution:
test.setValues("a,b")
This will successfully set a multivalue checkbox field to both a and b. This must be an exact string match (so if value is A use A and not a).
To clear all values use
test.setValues("null")
It's rather counter-intuitive and afaict riddled with bugs (normal multi value fields don't work, only checkbox fields. Radio buttons are processed as multivalue fields which they are clearly not. Etc.)