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

Extend ConfigArgs with default, nullable, required #643

Closed
chladog opened this issue Jan 12, 2021 · 2 comments
Closed

Extend ConfigArgs with default, nullable, required #643

chladog opened this issue Jan 12, 2021 · 2 comments
Milestone

Comments

@chladog
Copy link
Contributor

chladog commented Jan 12, 2021

Is your feature request related to a problem? Please describe.
In new Fulfillment handler feature we are using ConfigArgs to define fields. However some fields we want to set by default to some value (e.g. we want to set pickup date to null - currently datetime picker automatically sets "now"), we want to be able to set value of checkbox, as well as we want to be able to have field not mandatory (e.g. manual fulfillment handler now requires filling both input fields before we are allowed to submit fulfillment form).

Describe the solution you'd like
Extend ConfigArgs with properties that would allow similiar functionality as CustomFields:

  • required: boolean
  • nullable: boolean
  • defaultValue: null | based on type of the field

Additionally set fields of manual fulfillment handler to requred: false, so it's possible to fulfill an order without tracking code.

Additionally currently I use boolean in ConfigArgs. In the form by default the input is checked (though there is no "default" set - so should be unchecked?), however the submit button is disabled, I have to uncheck and check it again to be able to submit the form (maybe the form validation is not run by this time, or is not possible to submit pristine form?)

Additional context
v0.18.1

@michaelbromley michaelbromley added this to the v0.18.3 milestone Jan 13, 2021
@michaelbromley
Copy link
Member

I'm working on this now, and I have a question maybe you can clarify:

What's the difference between "required" and "nullable"? Are they not just the inverse of one another in this context?

@chladog
Copy link
Contributor Author

chladog commented Jan 26, 2021

@michaelbromley You are right.
I guess I mixed my thoughts with "undefined vs null" as JavaScript perceives it, but in this case we do not need undefined state, that would be "null". Therefore just either required or nullable is needed.

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

2 participants