Skip to content

Commit

Permalink
fix(core): Prevent reloads when hitting enter in create pipeline modal (
Browse files Browse the repository at this point in the history
  • Loading branch information
spinnakerbot authored and louisjimenez committed Jul 26, 2019
1 parent 022f289 commit 39a74be
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,9 @@ export class CreatePipelineModal extends React.Component<ICreatePipelineModalPro
}
}

// Prevents the form from reloading the page if the user hits enter on an input.
private handleFormSubmit = (e: React.FormEvent<HTMLFormElement>) => e.preventDefault();

public render() {
const { preselectedTemplate } = this.props;
const hasSelectedATemplate = this.state.useTemplate || preselectedTemplate;
Expand Down Expand Up @@ -379,7 +382,7 @@ export class CreatePipelineModal extends React.Component<ICreatePipelineModalPro
</div>
)}
{!(this.state.saveError || this.state.loadError) && (
<form role="form" name="form" className="clearfix">
<form role="form" name="form" className="clearfix" onSubmit={this.handleFormSubmit}>
{!preselectedTemplate && (
<div className="form-group clearfix">
<div className="col-md-3 sm-label-right">
Expand Down

0 comments on commit 39a74be

Please sign in to comment.