tcomb-form icon indicating copy to clipboard operation
tcomb-form copied to clipboard

id is not unique when two form in one page

Open snadn opened this issue 6 years ago • 3 comments

Version

Tell us which versions you are using:

  • tcomb-form v0.9.19
  • react v16.2.0

Expected behaviour

id is unique in page

Actual behaviour

same id in page

Steps to reproduce

image image

Stack trace and console log

Hint: it would help a lot if you enable the debugger ("Pause on exceptions" in the "Source" panel of Chrome dev tools) and spot the place where the error is thrown

image

snadn avatar Mar 15 '18 07:03 snadn

I found this behavior when the input element auto-filled by the browser. Generally, users will remember their username and password on the browser. But I do not resole this problem property. Waiting for a nice solution.

febaoshan avatar Apr 13 '18 07:04 febaoshan

I haven't used this library on the web. I've only used it for iOS app development. So I'm not sure this will help, but you can set an ID for each element in your form options:

let options = {
    fields: {
      my_field: {
         id: 'my_id',
         label: 'something'
      },
      my_other_field: {
          id: 'my_other_id',
...

arnoldbird avatar May 16 '18 19:05 arnoldbird

Following code will do the trick for tcomb-form"^0.9.21"

let options = {
    fields: {
        email_form: {
            attrs: {
                id: 'my_id'
            }
        },
    }
}

Mike-Zhylevych avatar Oct 11 '18 13:10 Mike-Zhylevych