Skip to content

Commit

Permalink
Fix issue #171
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanEngland committed Jun 26, 2024
1 parent 3a3a6a6 commit f976cfc
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ export default function CycleObservatoryPanel() : ReactElement {
const [observatorySearchData, setSearchData] = useState([]);
const [formReady, setFormReady] = useState(false);
const form = useForm({
initialValues: {selectedObservatory: 0},
initialValues: {selectedObservatory: "0"},
validate: {
selectedObservatory: (value) => (
value === 0 || value === null ? 'Please select an observatory' : null)
value === "0" || value === null ? 'Please select an observatory' : null)
}
});

Expand All @@ -44,7 +44,7 @@ export default function CycleObservatoryPanel() : ReactElement {
{pathParams: {cycleCode: Number(selectedCycleCode)}})
.then((observatory) => {
//FIXME: None of these three ways to set the default value seem to work
form.values.selectedObservatory = Number(observatory?._id);
form.values.selectedObservatory = String(observatory?._id);
//form.setFieldValue('selectedObservatory', Number(observatory?._id));
//form.setInitialValues({selectedObservatory: Number(observatory?._id)});
setFormReady(true);
Expand Down

0 comments on commit f976cfc

Please sign in to comment.