Skip to content

Commit

Permalink
feat(Form): safely prevent default on submit (#1786)
Browse files Browse the repository at this point in the history
  • Loading branch information
levithomason authored Jun 22, 2017
1 parent c196143 commit 65fd10c
Show file tree
Hide file tree
Showing 12 changed files with 958 additions and 337 deletions.
2 changes: 1 addition & 1 deletion docs/app/Components/IconSearch/IconSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export default class IconSearch extends Component {
return (
<Grid columns={1} padded textAlign='center' style={gridStyle}>
<Grid.Column>
<Form onSubmit={(e) => e.preventDefault()}>
<Form>
<Form.Group inline>
<Form.Input
id='docs-icon-set-input'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ class FormExampleCaptureValues extends Component {
handleChange = (e, { name, value }) => this.setState({ [name]: value })

handleSubmit = e => {
e.preventDefault()
const { name, email } = this.state

this.setState({ submittedName: name, submittedEmail: email })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ class FormExampleClearOnSubmit extends Component {

handleChange = (e, { name, value }) => this.setState({ [name]: value })

handleSubmit = e => {
e.preventDefault()
this.setState({ email: '', name: '' })
}
handleSubmit = e => this.setState({ email: '', name: '' })

render() {
const { name, email } = this.state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const CommentExampleReplyForm = () => (
<Comment.Actions>
<Comment.Action active>Reply</Comment.Action>
</Comment.Actions>
<Form reply onSubmit={e => e.preventDefault()}>
<Form reply>
<Form.TextArea />
<Button content='Add Reply' labelPosition='left' icon='edit' primary />
</Form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const CommentExampleReplyFormOuter = () => (
</Comment.Content>
</Comment>

<Form reply onSubmit={e => e.preventDefault()}>
<Form reply>
<Form.TextArea />
<Button content='Add Comment' labelPosition='left' icon='edit' primary />
</Form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const CommentExampleComment = () => (
</Comment.Content>
</Comment>

<Form reply onSubmit={e => e.preventDefault()}>
<Form reply>
<Form.TextArea />
<Button content='Add Reply' labelPosition='left' icon='edit' primary />
</Form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const CommentExampleMinimal = () => (
</Comment.Content>
</Comment>

<Form reply onSubmit={e => e.preventDefault()}>
<Form reply>
<Form.TextArea />
<Button content='Add Reply' labelPosition='left' icon='edit' primary />
</Form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const CommentExampleThreaded = () => (
</Comment.Content>
</Comment>

<Form reply onSubmit={e => e.preventDefault()}>
<Form reply>
<Form.TextArea />
<Button content='Add Reply' labelPosition='left' icon='edit' primary />
</Form>
Expand Down
Loading

0 comments on commit 65fd10c

Please sign in to comment.