2017-08-08 53 views
0

我是React和reactstrap的新手,我想知道如何设置一个表单,使用Form标签提交到路径后提交。我在找到这个文档的文档中找不到示例。所以我在寻找这样的一个等价的:如何在React中使用reactstrap库设置发布表单?

<form action='/signup/insert' method = 'POST'> 
    <div class="form-group"> 
     <input id ='signup' type='text' name='uid' placeholder='Username'><br> 
     <input id ='signup' type='password' name='pwd' placeholder='Password'><br> 
     <input id ='signup' type='text' name='email' placeholder='E-mail address'><br> 
     <button id = 'switch' type='submit'>Sign Up</button> 
    </div> 
</form> 

我想是这样的:

<Form> 
    <FormGroup> 
     <Label for="exampleEmail">Email</Label> 
     <Input 
      type="email" 
      name="email" 
      id="exampleEmail" 
      placeholder="[email protected]" 
     /> 
    </FormGroup> 
    <FormGroup> 
     <Label for="examplePassword">Password</Label> 
     <Input 
      type="password" 
      name="password" 
      id="examplePassword" 
      placeholder="password" 
     /> 
    </FormGroup> 
    <Button>Sign Up</Button> 
</Form> 

我一定要在按钮标记添加呢?这个怎么做?我的路线已经建立,所以我只需要从这里发布。

回答

1

与您的示例中没有Reactstrap的方式完全相同。 Form组件通过您所提供的是获取呈现在网页上所以这段代码<Form action='/signup/insert' method='POST'>将工作(如果你的后台设置来处理请求的<form>标签的任何属性。

+0

JEP,谢谢,我已经有它想通了。免费给你奖励! – Ansjovis86

相关问题