Skip to content

Commit

Permalink
Catch the error for not filling Keywords in DOI form
Browse files Browse the repository at this point in the history
  • Loading branch information
hannyle authored and genie9 committed May 27, 2022
1 parent e333877 commit 3b143f1
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1276,8 +1276,7 @@ const FormTagField = ({ name, label, required, description }: FormFieldBaseProps
name={name}
control={control}
defaultValue={defaultValue}
rules={{ required: true }}
render={({ field, formState }) => {
render={({ field }) => {
const handleKeywordAsTag = (keyword: string) => {
// newTags with unique values
const newTags = !tags.includes(keyword) ? [...tags, keyword] : tags
Expand Down Expand Up @@ -1313,7 +1312,11 @@ const FormTagField = ({ name, label, required, description }: FormFieldBaseProps

return (
<div className={classes.divBaseline}>
<input hidden={true} {...field} />
<input
{...field}
required={required}
style={{ width: 0, opacity: 0, transform: "translate(8rem, 2rem)" }}
/>
<ValidationTagField
InputProps={{
startAdornment:
Expand All @@ -1340,14 +1343,12 @@ const FormTagField = ({ name, label, required, description }: FormFieldBaseProps
onKeyDown={handleKeyDown}
onBlur={handleOnBlur}
/>

{description && (
<FieldTooltip title={description} placement="top" arrow>
<HelpOutlineIcon className={classes.fieldTip} />
</FieldTooltip>
)}
{required && formState.isSubmitted && !formState.isValid && tags.length === 0 && (
<FormHelperText error>must have at least 1 keyword</FormHelperText>
)}
</div>
)
}}
Expand Down

0 comments on commit 3b143f1

Please sign in to comment.