0
votes

I have a checkbox group and I am trying to get the values ​​selected via SSJS, but so far I have not been successful. I've tried several syntaxes, such as: document1.getItemValueArray ("nameField") and getComponent ("nameField") getSelectedValues ​​();

Does anyone know a way to get the selected values ​​from a checkbox group?

1
Do you have the checkbox group bound to "nameField"? Can you add your checkbox markup?Michael G. Smith

1 Answers

1
votes

document1.getFirstItem("nameField").getValues() may be what you want. If it's one value, it will be a string, not a Vector, which may be a problem with getItemValueArray().

With ODA (OpenNTF Domino API), we extended the getItemValue() method to take a second parameter and cast the result to that kind of object. That has a big benefit for this kind of scenario, allowing getItemValue("nameField", ArrayList.class) to always return an ArrayList even for a single value, plus ArrayList is a much better and more modern Java (so relevant also for SSJS) construct than a Vector.