gcanti / tcomb-form

Forms library for react
https://gcanti.github.io/tcomb-form
MIT License
1.16k stars 136 forks source link

Form templates containing tabs do not work #335

Closed mandeepbrar closed 8 years ago

mandeepbrar commented 8 years ago

Version

Tell us which versions you are using:

User should be able to save form when the form elements are split in different tabs

Actual behaviour

Get an error message 'Invalid value undefined supplied to Struct'.

Steps to reproduce

  1. Provide a template for rendering the form with react-tabs library. (Also tried with react-simpletabs library)
<Tabs>
          <TabList>
            <Tab>t1</Tab>
            <Tab>t2</Tab>
          </TabList>
          <TabPanel>
            <div>{locals.inputs.f1}</div>
          </TabPanel>
          <TabPanel>
            <div>{locals.inputs.f2}</div>
          </TabPanel>
        </Tabs>
  1. Save the form
  2. The form fails to save with an error message 'Invalid value undefined supplied to Struct'
  3. Remove the tabs from the template. The form works fine.
gcanti commented 8 years ago

By default react-tabs will only render the selected tab's contents, you can fix that using forceRenderTabPanel:

<Tabs forceRenderTabPanel>
...
</Tabs>
mandeepbrar commented 8 years ago

Thanks. Works great.