question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

<FileInput> doesn't work

See original GitHub issue

I have a simple form for editing emails:

<Edit {...props} undoable={false}>
    <SimpleForm>
        <TextField source="id" />
        <TextInput source="name" />
        <TextInput source="subject" />
        <RichTextInput source="body" />
        <FileInput source="attachment">
            <FileField source="src" title="title" />
        </FileInput>
    </SimpleForm>
</Edit>

When I save it without any files, it’s okay. But if I add some file, and click “Save” button, I have next error:

sanitizeEmptyValues.js:16 Uncaught TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at sanitizeEmptyValues (sanitizeEmptyValues.js:16)
    at sanitizeEmptyValues.js:18
    at Array.reduce (<anonymous>)
    at sanitizeEmptyValues (sanitizeEmptyValues.js:16)
    at submit (SimpleForm.js:60)
    at Object.submit (final-form.es.js:1291)
    at handleSubmit (react-final-form.es.js:263)
    at SimpleForm.js:118
    at handleMouseDown (SaveButton.js:115)
    at ButtonBase.js:145
    at useEventCallback.js:15
    at HTMLUnknownElement.callCallback (react-dom.development.js:337)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:386)
    at invokeGuardedCallback (react-dom.development.js:439)
    at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:454)
    at executeDispatch (react-dom.development.js:585)
    at executeDispatchesInOrder (react-dom.development.js:610)
    at executeDispatchesAndRelease (react-dom.development.js:713)
    at executeDispatchesAndReleaseTopLevel (react-dom.development.js:722)
    at forEachAccumulated (react-dom.development.js:694)
    at runEventsInBatch (react-dom.development.js:739)
    at runExtractedPluginEventsInBatch (react-dom.development.js:881)
    at handleTopLevel (react-dom.development.js:5832)
    at batchedEventUpdates$1 (react-dom.development.js:24387)
    at batchedEventUpdates (react-dom.development.js:1414)
    at dispatchEventForPluginEventSystem (react-dom.development.js:5928)
    at attemptToDispatchEvent (react-dom.development.js:6045)
    at dispatchEvent (react-dom.development.js:5948)
    at unstable_runWithPriority (scheduler.development.js:704)
    at runWithPriority$2 (react-dom.development.js:12232)
    at discreteUpdates$1 (react-dom.development.js:24404)
    at discreteUpdates (react-dom.development.js:1439)
    at dispatchDiscreteEvent (react-dom.development.js:5915)

dependencies:

    "@material-ui/core": "^4.6.1",
    "body-parser": "^1.19.0",
    "connected-react-router": "^6.6.0",
    "create-react-app": "^3.2.0",
    "dotenv": "^8.2.0",
    "express": "^4.17.1",
    "express-basic-auth": "^1.2.0",
    "express-handlebars": "^3.1.0",
    "express-interceptor": "^1.2.0",
    "material-ui": "^0.20.2",
    "prop-types": "^15.7.2",
    "ra-core": "^3.0.0",
    "ra-data-json-server": "^3.0.0",
    "ra-input-rich-text": "^3.0.0",
    "ra-ui-materialui": "^3.0.0",
    "react": "^16.12.0",
    "react-admin": "^3.0.0",
    "react-dom": "^16.12.0",
    "react-final-form": "^6.3.3",
    "react-scripts": "^3.2.0",
    "react-split-pane": "^0.1.89"

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

0reactions
fzaninottocommented, Nov 29, 2019

Fixed by #4082

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML input type=“file” in Google Chrome not showing ...
This happened to me on Chrome v88.0, and I tried everything -- removing all the event handlers, making the simplest form possible, removing...
Read more >
Suddenly fileInput doesn't import file - RStudio Community
The fileInput opens a window to browser for a file, and selects it, but doesn't load the file. The file namne doesn't show...
Read more >
fileinput('upload') Method does not work in 5.0.9 #1550
The problem is when you call upload method to actually upload a file in the queue and after the process is complete, you...
Read more >
File input not working
Hello, I use MDB Pro and the file input not working anybody can help me ? My code: <form method="POST" action="profil.php" enctype="multipart/form-data"> ...
Read more >
<input type="file"> - HTML: HyperText Markup Language | MDN
A file input's value attribute contains a string that represents the ... of your code to function in browsers that don't implement them....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found