React-redux-form: Mask phone input

Created on 24 May 2016  路  4Comments  路  Source: davidkpiano/react-redux-form

Previously I was masking phone inputs (to turn 1112345678 into (111) 234-5678 in the form ui) with a function that ran when the form value was set

value={formatPhone(model.foo.phone) }

This no longer works in the latest version of rrf (0.12.6). Is there a recommended way to handle such a task?

question

Most helpful comment

All 4 comments

Sure, try this:

<Field model="model.foo.phone"
  parser={formatPhone}>
  <input type="text" />
</Field>

Check out this page for more info (warning: old docs but the code should still work with the _latest_ version of RRF): http://davidkpiano.github.io/react-redux-form/docs/index.html#/recipe/parse-fields

Sorry to resurrect this but curious if there is any new docs on doing masks. The old ones are gone from the internet.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iBasit picture iBasit  路  4Comments

kallemakynen picture kallemakynen  路  4Comments

varzock picture varzock  路  3Comments

ndevvy picture ndevvy  路  3Comments

stevenmason picture stevenmason  路  4Comments