Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weirdness when setting multiple-choice input options dynamically #470

Open
ctrueden opened this issue Sep 11, 2023 · 0 comments
Open

Weirdness when setting multiple-choice input options dynamically #470

ctrueden opened this issue Sep 11, 2023 · 0 comments

Comments

@ctrueden
Copy link
Member

From a Zulip topic by @emilmelnikov:

In the following example, target should be a dropdown list populated with values derived from other inputs when they change, but target renders as a normal text field.

public class SampleCommand extends DynamicCommand {
    @Parameter(label = "Input", callback = "inputChanged")
    String input;

    @Parameter(label = "Target", style = "listBox")
    String target;

    void inputChanged() {
        MutableModuleItem<String> item = getInfo().getMutableInput("target", String.class);
        item.setChoices(Arrays.asList("one", "two", "three"));
    }
}

It works when choices = {" "} is passed to @Parameter with listBox. Note the single space: passing an empty string results in NullPointerException.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant