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

Unable to use plain html tags inside FormField #7095

Open
Moullisha opened this issue Jan 25, 2024 · 1 comment
Open

Unable to use plain html tags inside FormField #7095

Moullisha opened this issue Jan 25, 2024 · 1 comment
Labels
waiting Awaiting response to latest comments

Comments

@Moullisha
Copy link

Using html tag inside FormField doesn't update the data and touched property comes out to be empty even though a value was entered for the input field.

Expected Behavior

Use of html tags should be allowed inside Grommet forms

Actual Behavior

Using an html tag inside a Grommet form doesn't update the value of the field.

URL, screen shot, or Codepen exhibiting the issue

Code sample -> https://codesandbox.io/s/priceless-darkness-f5dnfl?file=/src/App.js:496-501

@taysea
Copy link
Collaborator

taysea commented Feb 2, 2024

I believe this was answered here: https://grommet.slack.com/archives/C09QQEG69/p1706303661601269?thread_ts=1706093288.357739&cid=C09QQEG69

Copying text:

Components which contribute to the state of a Form tend to do so by explicitly calling a setValue on the FormContext. For example, TextInput has

    const [value, setValue] = formContext.useFormInput({
      name: readOnly ? undefined : name,
      value: valueProp,
    });

And it's internal onChange calls this setValue If you want some random or custom component/input to interact with the Form value, validation, etc, You'd have to do something similar.

@britt6612 britt6612 added the waiting Awaiting response to latest comments label Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting Awaiting response to latest comments
Projects
None yet
Development

No branches or pull requests

3 participants