Skip to content

Commit

Permalink
Merge pull request #5812 from driusan/Release21To22
Browse files Browse the repository at this point in the history
Branch Merge of 21.0 to 22.0
  • Loading branch information
driusan authored Nov 29, 2019
2 parents 646687f + 1895376 commit 7e5a051
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
3 changes: 3 additions & 0 deletions jsx/Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -1614,6 +1614,7 @@ class ButtonElement extends Component {
type={this.props.type}
className={this.props.buttonClass}
onClick={this.handleClick}
disabled={this.props.disabled}
>
{this.props.label}
</button>
Expand All @@ -1627,12 +1628,14 @@ ButtonElement.propTypes = {
name: PropTypes.string,
label: PropTypes.string,
type: PropTypes.string,
disabled: PropTypes.bool,
onUserInput: PropTypes.func,
};

ButtonElement.defaultProps = {
label: 'Submit',
type: 'submit',
disabled: null,
buttonClass: 'btn btn-primary',
columnSize: 'col-sm-9 col-sm-offset-3',
onUserInput: function() {
Expand Down
2 changes: 1 addition & 1 deletion modules/candidate_list/jsx/candidateListIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class CandidateListIndex extends Component {

if (column === 'Subproject') {
// If user has multiple subprojects, join array into string
let result = (cell) ? <td>{cell.join(', ')}</td> : null;
let result = (cell) ? <td>{cell.join(', ')}</td> : <td></td>;
return result;
}

Expand Down
6 changes: 3 additions & 3 deletions modules/login/php/requestaccount.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ class RequestAccount extends \NDB_Form
function _process($values)
{
$DB = \Database::singleton();
$name = htmlspecialchars($_REQUEST["firstname"], ENT_QUOTES);
$lastname = htmlspecialchars($_REQUEST["lastname"], ENT_QUOTES);
$from = htmlspecialchars($_REQUEST["from"], ENT_QUOTES);
$name = trim(htmlspecialchars($_REQUEST["firstname"], ENT_QUOTES));
$lastname = trim(htmlspecialchars($_REQUEST["lastname"], ENT_QUOTES));
$from = trim(htmlspecialchars($_REQUEST["from"], ENT_QUOTES));
$site = $_REQUEST["site"];
$fullname = $name." ".$lastname;

Expand Down
7 changes: 7 additions & 0 deletions modules/new_profile/jsx/NewProfileIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class NewProfileIndex extends React.Component {
isLoaded: false,
isCreated: false,
error: false,
submitDisabled: false,
};
this.handleSubmit = this.handleSubmit.bind(this);
this.setFormData = this.setFormData.bind(this);
Expand Down Expand Up @@ -88,6 +89,9 @@ class NewProfileIndex extends React.Component {
}
formObject.append('fire_away', 'New Candidate');

// disable button to prevent form resubmission.
this.setState({submitDisabled: true});

fetch(this.props.submitURL, {
method: 'POST',
cache: 'no-cache',
Expand All @@ -102,6 +106,8 @@ class NewProfileIndex extends React.Component {
});
} else {
resp.json().then((message) => {
// enable button for form resubmission.
this.setState({submitDisabled: false});
swal.fire('Error!', message, 'error');
});
}
Expand Down Expand Up @@ -239,6 +245,7 @@ class NewProfileIndex extends React.Component {
label = "Create"
id = "button"
type = "submit"
disabled={this.state.submitDisabled}
/>
</FormElement>
);
Expand Down

0 comments on commit 7e5a051

Please sign in to comment.