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

Option to switch from Asterisks (*) for required fields to showing (optional) in label for non-required fields #1500

Closed
andrewhawkes opened this issue Jul 13, 2023 · 5 comments
Milestone

Comments

@andrewhawkes
Copy link

andrewhawkes commented Jul 13, 2023

What are you trying to do?

By default, if you make a field required an asterisk will be added next to the label like so:

First name *

It would be good if you could switch this off and instead show an "optional" label as part of the regular label on fields that are not required. i.e.:

Telephone (optional)

What's your proposed solution?

Obviously, this would be doable by a custom template but it would be nice if it could be a baked-in option as it seems relatively simple.

The reasoning for this is from a UX perspective it could be argued that this is a better solution vs the current way.

Additional context

A good article about required and optional fields: https://adamsilver.io/blog/how-to-highlight-required-and-optional-form-fields/

@engram-design
Copy link
Member

I recall reading up on several UX articles about this, and can see benefits to either approach (using an asterisk to denote a required field, and optional for optional ones).

I'll consider the best way to approach this. It'll likely be a form-wide, or plugin-wide setting to either:

  • Use an asterisk to denote required fields
  • Use optional to denote non-required fields

This'll be a pretty contentious setting I would say, so at least having it configurable would be best. It's such an incredibly common pattern using asterisks for this, as opposed to having (optional) shown on just about every other field.

@andrewhawkes
Copy link
Author

@engram-design sounds good. Having the option would be great and like you said the asterisk is probably more common/known so it's probably worth having that by default.

@sa-mussen
Copy link

Thanks for introducing this feature.
When trying it out I come across this issue:
when selecting the option of 'Optional indicator for non-required field' all the labels in the form (required and non-required) get the optional label

@engram-design
Copy link
Member

Fixed for the next release. To get this early, run composer require verbb/formie:"dev-craft-5 as 3.0.0-beta.14".

@engram-design engram-design removed the beta label Aug 6, 2024
@engram-design
Copy link
Member

Added in 3.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants