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

[FormBuilder] Add supports for related fields #7

Open
MangelMaxime opened this issue Nov 8, 2019 · 0 comments
Open

[FormBuilder] Add supports for related fields #7

MangelMaxime opened this issue Nov 8, 2019 · 0 comments
Labels
enhancement New feature or request question Further information is requested Thoth.Elmish.FormBuilder

Comments

@MangelMaxime
Copy link
Contributor

Issue by MangelMaxime
Thursday Nov 29, 2018 at 12:37 GMT
Originally opened as MangelMaxime/Thoth#94


From @tforkmann on Gitter

I'm just trying out your FormBuilder. Its very cool! Is it possible to use the value of an already selected field for the next form element?

Sure! 1. Field: Select Plant get data from backend 2.field: take selected key from 1. field and get data from the backend using the selected key. That's what i have so far:

let formState, formConfig =
    Form<Msg>
        .Create(OnFormMsg)
        .AddField(
            BasicSelect
                .Create("selectPlant")
                .WithLabel("Anlagenauswahl")
                .WithValuesFromServer(getPlants) //Selected Key = PlantId
                .WithPlaceholder("")
                .IsRequired("Bitte wählen Sie eine Anlage aus!")
                .WithDefaultView()
        )
        .AddField(
            BasicSelect
                .Create("selectMeter")
                .WithLabel("Zählerauswahl")
                .WithValuesFromServer(getMeters "4" ) // -> Replace "4" with Selected PlantId in selectPlant Field
                .WithPlaceholder("")
                .IsRequired("Bitte wählen Sie einen Zähler aus!")
                .WithDefaultView()
        )
        .Build()
@MangelMaxime MangelMaxime added enhancement New feature or request question Further information is requested Thoth.Elmish.FormBuilder labels Nov 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested Thoth.Elmish.FormBuilder
Projects
None yet
Development

No branches or pull requests

1 participant