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

[FormsyText] Can't programatically set value #125

Open
thienanle opened this issue Aug 3, 2016 · 2 comments
Open

[FormsyText] Can't programatically set value #125

thienanle opened this issue Aug 3, 2016 · 2 comments

Comments

@thienanle
Copy link

In my component I have

<FormsyText
    ref={(ref) => this._textInput = ref}
    value={someString} // this only works on initial render, not when someString changes
    ...
/>

I try to set its value with the below code, but nothing happens.

this._textInput.setValue('some value')

What am I doing wrong?

@timothyallan
Copy link

timothyallan commented Aug 9, 2016

I have the same issue with a custom onBlur function using setValue via a ref. I can see it hit the setValue function in Mixin.js, set the state once, then call my onBlur function, get the correct value... but never show it.

That said, I just figured out that you CAN do this._textInput.state.value = 'blah', but that feels a bit dirty.

@ryanblakeley
Copy link
Collaborator

Please test with latest v0.5.4. Think this is fixed now.

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

3 participants