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

How to work with input fields for the @bind-value #44

Open
WimVdSElia opened this issue May 13, 2024 · 3 comments
Open

How to work with input fields for the @bind-value #44

WimVdSElia opened this issue May 13, 2024 · 3 comments

Comments

@WimVdSElia
Copy link

Hi @jsakamoto,

How could I do the @bind-Value for InputText from blazor in BlazingStory.
Or all other input fields with the parent EditForm.

@luissalgadofreire
Copy link

luissalgadofreire commented May 23, 2024

Hi, @WimVdSElia.

I just went through it and saw another issue with the answer (buried in a zip file). Just replace Spicy with Fluent below.

Gotcha: this allows you to edit the input directly in the component, but not in the controls.

Hope it helps.

@attribute [Stories("Inputs/TextField")]

<Stories TComponent="SpicyTextField">
    <Story Name="Default">

        <Arguments>
            <Arg For="spicyTextField => spicyTextField.Label" Value='"TextField"'/>
            <Arg For="spicyTextField => spicyTextField.Value" Value="@value"/>
        </Arguments>

        <Template>
            <SpicyStack Style="margin: 20px;" Orientation="Orientation.Vertical">
                <SpicyTextField @attributes="context.Args" @bind-Value="@value"/>
                <div>
                    You entered: @value
                </div>
            </SpicyStack>
        </Template>

    </Story>

</Stories>

@code
{
    string value;
}

@WimVdSElia
Copy link
Author

This is not what I asked for! I asked: how could I do a 2 way binding?

@luissalgadofreire
Copy link

luissalgadofreire commented May 30, 2024

You specifically asked: "How could I do the @bind-Value for InputText from blazor in BlazingStory." And the title of your issue is "How to work with input fields for the @bind-value". That is what you wrote. It you want specific answers, ask specific questions.

If you had looked in other questions in this repo, you would have seen issue #38, which asked something similar. It suggests a limitation, which I mentioned:

  • You can either edit the input field's value from inside the component and bind it to a variable as I did in the example above.
  • Or you can edit the value from Blazing Story's controls and bind it to a variable.
  • At this time, not both, apparently.

If you mean something else entirely, I suggest you update your question with what exactly are you trying to achieve, what have you tried so far and what exactly isn't working. Perhaps someone else will bulk in and try to answer.

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