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

Select/combobox #50

Closed
skadefro opened this issue Aug 19, 2021 · 2 comments
Closed

Select/combobox #50

skadefro opened this issue Aug 19, 2021 · 2 comments

Comments

@skadefro
Copy link

Hey
I'm trying to create a combobox/select from a list, not a hardcoded list of options.
Is that possible ?
I have look at FormBuilder and looks it should support setting the list using the "from" property.
I tried with array of string, array of Forge.Forms.FormBuilding.SelectOption and JArray containing object's with a Name and Value.

Select in xmlString

    <select from="{ContextBinding Doctors}" name="Doctor" label="Appointed doctor"
displayPath="Name" valuePath="Value"
 />

Show form

                var f = new Form(xmlString);
                f.defaults = param;
                f.Topmost = true;
                if (f.ShowDialog() == false)
                {
                    if (f.LastError != null) LastError = f.LastError;
                }

So "params" is an Dictionary<string, object>(); and in that i have added add Doctor as a string, and I have tried adding Doctors as several different types including the mentioned above but with no luck so far.
Is this even possible ?

@edongashi
Copy link
Collaborator

Hi @skadefro.

The From property can be bound to a collection of items. The XML you posted should work, under the assumption that there's a non-null Doctors property in your Form.Context.

If you want to access things from the model itself, use {Binding}, example {Binding Doctors} or {Binding defaults.Doctors}.

@skadefro
Copy link
Author

skadefro commented Aug 19, 2021

Ahh, Binding Doctors worked :-) thank you very much for a fast, informative and precise response.

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

2 participants