-
-
Notifications
You must be signed in to change notification settings - Fork 390
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
Meta api for form fields #1111
Comments
Hey 👋 , this sounds like a great idea. Personally, I prefer the second version (less verbose and more straight-forward). Are you still ready to create a PR? If yes, then this is the "go ahead"! Edit: Just to make it easy for people who visit this discussion later, this is the second version: // or maybe expose values directly like form.Subscribe
meta={({ values }) => ({
disabled: values.someOtherField == null,
...
})} |
Yeah, me too. Absolutely, I'll start it this week, and hopefully have a PR ready by next weekend. 🫡 Thanks for the go ahead 🤘 |
Thank you for your enthusiasm! 🙌 Feel free to ping me in the comments when the PR is ready! |
@fulopkovacs, l've left a couple questions on #1125. If you get a chance to take a look it would be appreciated 🤟 |
Awesome, thanks for your work! I'll look at them tomorrow, this week was pretty busy... |
@fulopkovacs, no worries... thanks! |
✨ Hi everyone, I commented on a post by @crutchcorn on LinkedIn and we talked about disabling form-fields. I was told it is okay to have a discussion about it here as a part of this issue. I have this request/idea that I would like to suggest, a Anyway.. what are your thoughts about such feature ( |
Hi @itayperry, have you checked out the PR over at #1125. That's kind of the idea I was going for... in a sense that you can create your own meta for your fields. <form.Field
name="foo"
meta={({ values }) => ({
disabled: values.someOtherField == null,
...
})}
>
{(field, meta) =>
<Component
disabled={meta.disabled}
... >
</Component> I've got a working MVP that allows for this functionality. Dose this api address your needs? |
Hi there @harry-whorlow, |
@itayperry the field.meta is stored in the form store... so yes it will be accessible globally. I know I asked this, but that was a couple weeks ago and I now realise that question doesn’t make a lot of sense, plus the value exists in the store... its more the Ts inference thing. I think for all intents and purposes, that question can be ignored 🙃 But the meta api is for user defined meta so if you don't add it it won't show up. I suppose we could always add disabled to the FieldMetaBase type. |
@harry-whorlow |
@itayperry yeah, you can see it in the image I posted, but if you log the meta its there, its just Ts inference... But, as I said just ignore the question as it needs to be globally typed. |
What are your thoughts regarding a global mechanism, such as |
Continuation from the discussion #709. Listeners are implemented, however the meta field is yet to be started.
The proposal is to have the meta data available to the field component:
(example shamelessly ripped form #709)
You can subscribe to the meta from the Form but its pretty handy to have it available to the Field component.
I'm happy to give this a go, I just need the go ahead from a maintainer. 🤟
The text was updated successfully, but these errors were encountered: