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

Allow do extra control on controlled fields #46

Closed
leandrohsilveira opened this issue Jan 30, 2018 · 0 comments
Closed

Allow do extra control on controlled fields #46

leandrohsilveira opened this issue Jan 30, 2018 · 0 comments
Assignees
Milestone

Comments

@leandrohsilveira
Copy link
Owner

leandrohsilveira commented Jan 30, 2018

When using "Field" component, allow provide an "onBlur" property to do extra "blur" control.

<Field 
    form="t" 
    name="a" 
    onChange={extraChangeControl} 
    onBlur={extraBlurControl)
    onReset={extraResetControl}
>
    <MyInputComponent />
</Field>

When using "controlledField" decorator, use the "onChange" and "onBlur" properties to the extra control.

let MyInputComponent = (props) => {
    return (
        <input 
              type={props.type} 
              value={props.value} 
              onChange={props.onChange} // this is the injected handler
              onBlur={props.onBlur} // this is the injected handler
         />
    )
}

MyInputComponent = controlledField()(MyInputComponent)

<MyInputComponent 
    form="t"
    name="a"
    onChange={extraChangeControl}
    onBlur={extraBlurControl}
    onReset={extraResetControl}
/>

Requirements

  • The extra "onChange" and "onBlur" handlers should be invoked after controllers update.
@leandrohsilveira leandrohsilveira self-assigned this Jan 31, 2018
@leandrohsilveira leandrohsilveira moved this from To Do to In Progress in React controlled forms Feb 5, 2018
leandrohsilveira added a commit that referenced this issue Feb 7, 2018
leandrohsilveira added a commit that referenced this issue Feb 7, 2018
@leandrohsilveira leandrohsilveira moved this from In Progress to Done in React controlled forms Feb 7, 2018
@leandrohsilveira leandrohsilveira added this to the v1.4.0 milestone Feb 9, 2018
@leandrohsilveira leandrohsilveira moved this from Done to Published in React controlled forms Feb 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

1 participant