Comments (13)
I received an answer in the TypeScript Discord and am now checking if the given solution works for Modular Forms.
from modular-forms.
No rush, thanks man
from modular-forms.
Sorry. I haven't gotten around to it yet. I'll get back to you as soon as I find time for it.
from modular-forms.
Can you share a code sample with me so that I can understand your problem even better?
from modular-forms.
Thanks for the reply, here's an outline:
- I define a schema that inherits from an external class: https://github.com/meshtastic/web/blob/master/src/validation/config/position.ts inherits from https://js.meshtastic.org/classes/Protobuf.Config_PositionConfig.html
- I have a "form generator" that takes a generic(the validation schema from earlier) and a schema to define the physical layout: https://github.com/meshtastic/web/blob/master/src/components/PageComponents/Config/Position.tsx
- Finally the generator itself (currently using react-hook-form): https://github.com/meshtastic/web/blob/master/src/components/Form/DynamicForm.tsx https://github.com/meshtastic/web/blob/master/src/components/Form/DynamicFormField.tsx
Hopefully this is clear enough, thanks.
from modular-forms.
Is your problem that the derived type is an interface and Modular Forms throws an error when you pass it as generic or does your problem relate to validating the form inputs?
from modular-forms.
The former. I am unable to use your previous guidance of using a type instead of an interface
from modular-forms.
Unfortunately, I don't know any solution for this at the moment. To make the form values type-safe even with nested objects and arrays, I use a recursive type and this approach leads to problems when using interfaces. I will ask for advice in the TypeScript Discord. However, it is uncertain if there is a solution for this as described in #2. I will report here as soon as I have an answer.
from modular-forms.
I have been busy with other things the last few days. I hope to give you feedback on this over the weekend.
from modular-forms.
Found a workaround:
The yup
validation library has ObjectSchema
that allows deriving a schema from an external class definition.
So maybe this issue can be converted to requesting support for yup
from modular-forms.
Thanks for the info! Do you have a code example? Do you also work with Yup and need adapters for validation with Modular Forms?
from modular-forms.
All solutions I know so far to be able to support interfaces reduce type safety. I have again experimented a bit, but have not come to a satisfactory solution.
from modular-forms.
I'm temporarily closing the issue until there are signs that changes to our code can fix the problem.
from modular-forms.
Related Issues (20)
- FieldArray length wrong when using `remove()` and `getValues` with `shouldActive: false` HOT 7
- Detail how input components work with FieldArray? HOT 3
- Qwik "special form" example doesn't work with number select box HOT 14
- Qwik formAction with zod preprocess isnt possible HOT 5
- Qwik "special form" file uploading HOT 1
- onFormComplete for modular forms? HOT 3
- Runtime Error with 'FormError' Execution in Development Mode using QwikJS v1.2.6 and ModularForms v0.18.1 HOT 10
- Deno Compatibility? HOT 2
- vue support? HOT 3
- Conflict with dependency HOT 7
- How to validate a specific field when input changes (Solid) HOT 6
- Solid Kobalte Select example not working HOT 14
- Update peer dependencies for qwik HOT 2
- Confirm password and password validation HOT 1
- Qwik - Example to show confirmation dialog before submitting the form HOT 1
- More bugs with getValues HOT 3
- custom validators need some context, any context HOT 5
- defaultFilters HOT 1
- more critical bugs - this time getvalue on object HOT 10
- Bug: Unable to Edit Input in Modular Form in Production Mode (React ) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from modular-forms.