-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNoteCreate.js
More file actions
22 lines (18 loc) · 849 Bytes
/
NoteCreate.js
File metadata and controls
22 lines (18 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import React from 'react';
import { Create, TextInput, SimpleForm, required } from 'react-admin';
const NoteCreate = props => {
// Input --> Record
const parseInput = input => input && input.split(" ")
// Record --> Input
const formatInput = record => record && record.join(" ")
return (
<Create {...props} resource="notes" onSuccess={props.onSuccess} basePath="notes">
<SimpleForm initialValues={ {student: props.match.params.id} }>
<TextInput label="Note Title" source="title" validate={required()} />
<TextInput label="Note Content" source="body" validate={required()} />
<TextInput label="Tags" source="tags" validate={required()} format={formatInput} parse={parseInput} />
</SimpleForm>
</Create>
)
}
export default NoteCreate;