--- order: 3 title: zh-CN: 抽屉表单 en-US: Submit form in drawer --- ## zh-CN 在抽屉中使用表单。 ## en-US Use a form in Drawer with a submit button. ```jsx import { Drawer, Form, Button, Col, Row, Input, Select, DatePicker, Icon } from 'antd'; const { Option } = Select; class DrawerForm extends React.Component { state = { visible: false }; showDrawer = () => { this.setState({ visible: true, }); }; onClose = () => { this.setState({ visible: false, }); }; render() { const { getFieldDecorator } = this.props.form; return (
{getFieldDecorator('name', { rules: [{ required: true, message: 'Please enter user name' }], })()} {getFieldDecorator('url', { rules: [{ required: true, message: 'Please enter url' }], })( , )} {getFieldDecorator('owner', { rules: [{ required: true, message: 'Please select an owner' }], })( , )} {getFieldDecorator('type', { rules: [{ required: true, message: 'Please choose the type' }], })( , )} {getFieldDecorator('approver', { rules: [{ required: true, message: 'Please choose the approver' }], })( , )} {getFieldDecorator('dateTime', { rules: [{ required: true, message: 'Please choose the dateTime' }], })( trigger.parentNode} />, )} {getFieldDecorator('description', { rules: [ { required: true, message: 'please enter url description', }, ], })()}
); } } const App = Form.create()(DrawerForm); ReactDOM.render(, mountNode); ```