Skip to content

Commit

Permalink
[media] add feedback to dropdown field when is empty (#8402)
Browse files Browse the repository at this point in the history
Fixes #7951
  • Loading branch information
shonibare authored Mar 13, 2023
1 parent 25fa0bb commit 006f50a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions modules/media/jsx/uploadForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,14 @@ class MediaUploadForm extends Component {
&& this.state.formData.visitLabel ?
this.state.Data.sessionData[this.state.formData.pscid]
.instruments[this.state.formData.visitLabel] :
{};
return (
{};
const visitErrMsg = visits && visits.length === 0 ?
'No visits available for this candidate' :
'';
const instErrMsg = instruments && instruments.length === 0 ?
'No instruments available for this visit' :
'';
return (
<div className='row'>
<div className='col-md-8 col-lg-7'>
<FormElement
Expand Down Expand Up @@ -141,6 +147,7 @@ class MediaUploadForm extends Component {
name='visitLabel'
label='Visit Label'
options={visits}
placeholder={visitErrMsg}
onUserInput={this.setFormData}
ref='visitLabel'
required={true}
Expand All @@ -151,6 +158,7 @@ class MediaUploadForm extends Component {
name='instrument'
label='Instrument'
options={instruments}
placeholder={instErrMsg}
onUserInput={this.setFormData}
ref='instrument'
required={false}
Expand Down

0 comments on commit 006f50a

Please # to comment.