From f69e5a3af4042048387dffdb55f84f50830d13aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aliz=C3=A9e=20Bellerose?= Date: Thu, 28 Nov 2019 14:13:11 -0500 Subject: [PATCH 1/6] update --- jsx/Form.js | 2 ++ modules/new_profile/jsx/NewProfileIndex.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/jsx/Form.js b/jsx/Form.js index ab2e9216fab..b6c357d8c1e 100644 --- a/jsx/Form.js +++ b/jsx/Form.js @@ -1555,6 +1555,7 @@ class ButtonElement extends Component {
@@ -1570,10 +1570,10 @@ class ButtonElement extends Component { } ButtonElement.propTypes = { - id: PropTypes.string, name: PropTypes.string, label: PropTypes.string, type: PropTypes.string, + disabled: PropTypes.bool, onUserInput: PropTypes.func, }; diff --git a/modules/new_profile/jsx/NewProfileIndex.js b/modules/new_profile/jsx/NewProfileIndex.js index df96f5da476..24cb6f03373 100644 --- a/modules/new_profile/jsx/NewProfileIndex.js +++ b/modules/new_profile/jsx/NewProfileIndex.js @@ -20,6 +20,7 @@ class NewProfileIndex extends React.Component { isLoaded: false, isCreated: false, error: false, + disable: false, }; this.handleSubmit = this.handleSubmit.bind(this); this.setFormData = this.setFormData.bind(this); @@ -89,7 +90,8 @@ class NewProfileIndex extends React.Component { } formObject.append('fire_away', 'New Candidate'); - document.getElementById('button').disabled = true; + // disable form from resubmission. + this.setState({disabled: true}); fetch(this.props.submitURL, { method: 'POST', @@ -242,6 +244,7 @@ class NewProfileIndex extends React.Component { label = "Create" id = "button" type = "submit" + disabled={this.state.disable} /> ); From 7f3ec869618d81f9190248c90031a1e14fc1bdf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aliz=C3=A9e=20Bellerose?= Date: Thu, 28 Nov 2019 14:38:32 -0500 Subject: [PATCH 3/6] fix --- modules/new_profile/jsx/NewProfileIndex.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/new_profile/jsx/NewProfileIndex.js b/modules/new_profile/jsx/NewProfileIndex.js index 24cb6f03373..54b3b046a24 100644 --- a/modules/new_profile/jsx/NewProfileIndex.js +++ b/modules/new_profile/jsx/NewProfileIndex.js @@ -91,7 +91,7 @@ class NewProfileIndex extends React.Component { formObject.append('fire_away', 'New Candidate'); // disable form from resubmission. - this.setState({disabled: true}); + this.setState({disable: true}); fetch(this.props.submitURL, { method: 'POST', From 68dd82900613cbef517d5c738cdb51c7bea407d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aliz=C3=A9e=20Bellerose?= Date: Thu, 28 Nov 2019 15:19:45 -0500 Subject: [PATCH 4/6] update --- modules/new_profile/jsx/NewProfileIndex.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/new_profile/jsx/NewProfileIndex.js b/modules/new_profile/jsx/NewProfileIndex.js index 54b3b046a24..f81d8a1f1fa 100644 --- a/modules/new_profile/jsx/NewProfileIndex.js +++ b/modules/new_profile/jsx/NewProfileIndex.js @@ -20,7 +20,7 @@ class NewProfileIndex extends React.Component { isLoaded: false, isCreated: false, error: false, - disable: false, + submitDisabled: false, }; this.handleSubmit = this.handleSubmit.bind(this); this.setFormData = this.setFormData.bind(this); @@ -91,7 +91,7 @@ class NewProfileIndex extends React.Component { formObject.append('fire_away', 'New Candidate'); // disable form from resubmission. - this.setState({disable: true}); + this.setState({submitDisabled: true}); fetch(this.props.submitURL, { method: 'POST', @@ -107,6 +107,8 @@ class NewProfileIndex extends React.Component { }); } else { resp.json().then((message) => { + // enable form from resubmission. + this.setState({submitDisabled: false}); swal('Error!', message, 'error'); }); } @@ -244,7 +246,7 @@ class NewProfileIndex extends React.Component { label = "Create" id = "button" type = "submit" - disabled={this.state.disable} + disabled={this.state.submitDisabled} /> ); From a1750cf0bd2b41d83821d872b7346d9823288fc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aliz=C3=A9e=20Bellerose?= Date: Thu, 28 Nov 2019 15:34:37 -0500 Subject: [PATCH 5/6] update comment --- modules/new_profile/jsx/NewProfileIndex.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/new_profile/jsx/NewProfileIndex.js b/modules/new_profile/jsx/NewProfileIndex.js index f81d8a1f1fa..74df6840f15 100644 --- a/modules/new_profile/jsx/NewProfileIndex.js +++ b/modules/new_profile/jsx/NewProfileIndex.js @@ -90,7 +90,7 @@ class NewProfileIndex extends React.Component { } formObject.append('fire_away', 'New Candidate'); - // disable form from resubmission. + // disable button to prevent form resubmission. this.setState({submitDisabled: true}); fetch(this.props.submitURL, { @@ -107,7 +107,7 @@ class NewProfileIndex extends React.Component { }); } else { resp.json().then((message) => { - // enable form from resubmission. + // enable button for form resubmission. this.setState({submitDisabled: false}); swal('Error!', message, 'error'); }); From 1c426da4deafdf2e0669f5ee515ec397293c1cdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aliz=C3=A9e=20Bellerose?= Date: Thu, 28 Nov 2019 16:25:26 -0500 Subject: [PATCH 6/6] added zaliqa suggestion --- jsx/Form.js | 1 + 1 file changed, 1 insertion(+) diff --git a/jsx/Form.js b/jsx/Form.js index 13a922d99fe..c4bd324b032 100644 --- a/jsx/Form.js +++ b/jsx/Form.js @@ -1580,6 +1580,7 @@ ButtonElement.propTypes = { ButtonElement.defaultProps = { label: 'Submit', type: 'submit', + disabled: null, buttonClass: 'btn btn-primary', columnSize: 'col-sm-9 col-sm-offset-3', onUserInput: function() {