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

Read-only Masked Text Fields #444

Closed
hvilander opened this issue Sep 13, 2021 · 0 comments · Fixed by #450
Closed

Read-only Masked Text Fields #444

hvilander opened this issue Sep 13, 2021 · 0 comments · Fixed by #450

Comments

@hvilander
Copy link
Contributor

Masked text fields are awesome, but can lead to this use case.

I have a SQForm that is a read only view, it has all SQFormReadOnlyTextFields. I also have an edit modal, where I am using SQFormMaskedTextFields for things like phone, zip, etc.

With the ability and in many cases preference to strip the non-numeric characters from the value, we should also provide a way to display the masked value in a readonly style field

Example, a phone number field and use the stripNonNumeric prop. The value will have (, ), and, - removed and saved into the data base. If I want to show that value in a read only form it would be really nice to use an SQFormMaskedTextField.

Proposal, expose a readOnly boolean prop.

As a consumer of the current component I can do this:

<SQFormMaskedTextField
  label="Fax"
  name="fax"
   mask={MASKS.phone}
  size={4}
  InputProps={{ readOnly: true, disableUnderline: true }}
  muiFieldProps={{ helperText: '' }} // Disables the validation icon
/>

Which is hacky and not ideal. It does work. The ugliest part to me is disabling the validation icon.

If this is a reasonable addition, I would be happy to do this work. Didn't want to waste time one it if we thought it was a bad idea.

20BBrown14 added a commit that referenced this issue Sep 28, 2021
Adding a component to display masked text in a read only field

✅ Closes: #444
SeanGroff pushed a commit that referenced this issue Sep 28, 2021
## [5.6.0](v5.5.1...v5.6.0) (2021-09-28)

### Features

* 🎸 New component: SQFormMaskedReadOnlyField ([629848f](629848f)), closes [#444](#444)
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

Successfully merging a pull request may close this issue.

1 participant