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

Pass raw value to redux-form #129

Open
victorsilent opened this issue Jul 25, 2018 · 4 comments
Open

Pass raw value to redux-form #129

victorsilent opened this issue Jul 25, 2018 · 4 comments

Comments

@victorsilent
Copy link

Hello, I'm using that lib with material-ui and redux-form, so, actually I've passed the mask to redux-form, but only with mask, I saw that could be handle with ref.mask.getRawValue, so, how can I call that function to redux-form get raw value?

             <Field
                name="documentation.cpf"
                labelText="CPF"
                id="documentation.cpf"
                component={CustomInputRedux}
                InputProps={{
                  inputComponent: other => (
                    <MaskedInput
                      ref={this.cpfRef}
                      {...other}
                      mask={"111.111.111-11"}
                      placeholderChar={"\u2000"}
                    />
                  )
                }}
              />
@vaske
Copy link

vaske commented Sep 18, 2018

In onChage you can access to raw value like

onChange={(e) => {
   console.log(e.target.rawValue);
   }
}

and then I guess you may assign this to redux-form or add wrapped function to do it for you.

@wemersonrv
Copy link

Hi, i'm trying to use rawValue but not works.

<MaskedInput 
  name="cnpj" type="text" value={inputValue}
  onChange={(e) => {
    console.log(e.target.rawValue);
  }}
  mask="11.111.111/1111-11"
/>

The result is undefined

@victorsilent
Copy link
Author

You need to use ref to call rawValue

@nfantone
Copy link

nfantone commented Aug 3, 2020

This doesn't seem to work anymore. Using a ref, mask.getValue() and mask.getRawValue() return the exact same value for me. And target.rawValue is now absent from the synthetic event.

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

4 participants