Comments (6)
Thank you for creating the issue. I remember testing SUID with Modular Forms a few months ago. At that time there were no problems. I will have a look at it and give you feedback by tomorrow.
from modular-forms.
I will contant them and link this issue.
from modular-forms.
I don't know much about SUID or MUI component library, but took a look at the code on GitHub and suspect the following problem. The event listener that can be passed to the TextField
component via the onInput
prop is not added to the <input />
element but to an outer <div />
element. For this reason, the value can only be retrieved via event.target
and not via event.currentTarget
.
For Modular Forms it is important that the field.props
are passed directly to the <input />
element, because this is relevant for several functionalities of the library. For example, focusing an element on invalid input.
I therefore see the problem on the side of SUID. I tried via inputProps
and InputProps
to pass the field.props
directly to the <input />
element. Unfortunately without success. I recommend you to create an issue at SUID and exchange with @swordev. If needed, feel free to link me and this issue.
from modular-forms.
Is the problem still present? Should I create an issue at SUID?
from modular-forms.
I haven't really contacted them. I checked their source code for inputs and from my understanding (although i could be wrong) it seems, they are merging those two event handlers (onChange and onInput) together.
I tested it and it seems that the only way I could work around it is to remap the field.props for TextField.
So far I have used this workaround below.
import { FieldElement } from "@modular-forms/solid";
import { JSX } from "solid-js";
export const remapFieldProps = (fieldProps: {
name: string;
ref: (element: FieldElement) => void;
onInput: JSX.EventHandler<FieldElement, InputEvent>;
onChange: JSX.EventHandler<FieldElement, Event>;
onBlur: JSX.EventHandler<FieldElement, FocusEvent>;
}) => ({
name: fieldProps.name,
inputRef: fieldProps.ref,
onBlur: fieldProps.onBlur,
onChange: (e: any) => { fieldProps.onChange(e); fieldProps.onInput(e) }
});
=====================
<Field
of={loginForm}
name="email"
validate={[
required('Please enter your email.'),
email('Please enter a valid email address.')
]}
>
{(field) =>
<TextField
inputProps={{ ...remapFieldProps(field.props) }}
type="email"
value={field.value || ''}
error={Boolean(field.error)}
helperText={field.error}
/>}
</Field>
So far I haven't found any issue using this approach. But it may yet still come.
from modular-forms.
According to current knowledge, it looks like it is a "problem" with the naming on the part of SUID. Here is a workaround.
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.