mirror of
https://github.com/nowcommunity/nowdatabase.git
synced 2026-10-12 19:13:52 +03:00
add validation rules for museum code and change its textfield to use trim
This commit is contained in:
@@ -30,7 +30,7 @@ export const MuseumInfoTab = ({ isNew }: { isNew?: boolean }) => {
|
||||
['Country', dropdownWithSearch('country', countryOptions, 'Country')],
|
||||
['State', textField('state')],
|
||||
['State code', textField('state_code')],
|
||||
['Museum code', textField('museum', { type: 'text', readonly: !isNew })],
|
||||
['Museum code', textField('museum', { type: 'text', readonly: !isNew, trim: true })],
|
||||
]
|
||||
|
||||
return (
|
||||
|
||||
@@ -19,6 +19,11 @@ export const validateMuseum = (editData: EditDataType<Museum>, fieldName: keyof
|
||||
museum: {
|
||||
name: 'Museum',
|
||||
required: true,
|
||||
asString: museumCode => {
|
||||
if (museumCode.indexOf(' ') !== -1) return 'Museum code must not contain a space'
|
||||
if (museumCode.toUpperCase() !== museumCode) return 'Museum code must only contains uppercase characters'
|
||||
return null
|
||||
},
|
||||
},
|
||||
institution: {
|
||||
name: 'Institution',
|
||||
|
||||
Reference in New Issue
Block a user