Update ImageField on change of TextInput

2019-08-02 08:43发布

问题:

Given a SimpleForm:

<SimpleForm>
    <TextInput source="imageUrl" label="Image URL" />
    <ImageField source="imageUrl" label="Image" />
</SimpleForm>

I'd like to have the ImageField update as the user types in the TextInput. Is this somehow possible out of the box, or will I have to wire it up myself?

回答1:

You should probably build a custom input like the one we built for image upload. Instead of the file input, just use a text input and handle the image visualization inside it.