简体   繁体   English

如何在手风琴中包含表格? (反应,Formik)

[英]How do I include a form inside an accordion? (React, Formik)

I'm creating quite a large form application in ReactJS using Formik. 我正在使用Formik在ReactJS中创建一个很大的表单应用程序。 I want to divide my form into sections using a bootstrap accordion, but this has introduced some challenges for me. 我想使用Bootstrap手风琴将表格分成几个部分,但这给我带来了一些挑战。

My accordion is its own component, and consists of 3 sections. 我的手风琴是它自己的组件,由3个部分组成。 Each section imports a form component like so: 每个部分都导入一个表单组件,如下所示:

     Section 1
    <Accordion.Collapse eventKey="0">
      <Card.Body>
         <Form_part1/>
      </Card.Body>
    </Accordion.Collapse> 

I want to gather these forms so that I can send all the values simultaneously with a single submit button below the accordion. 我想收集这些表格,以便可以通过手风琴下方的一个提交按钮同时发送所有值。

I should probably use some sort of nested form, or sub-forms to achieve my goal, but don't know how to achieve this. 我可能应该使用某种嵌套形式或子形式来实现我的目标,但不知道如何实现。 Some pointers and a suggested file structure would be highly appreciated. 一些指针和建议的文件结构将不胜感激。

Oh, and I'm quite new to this library so excuse my ignorance! 哦,我是这个图书馆的新手,请原谅我的无知!

用一个Form组件包装手风琴,该组件可保存所有表单零件的状态

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM