[JAVA] File form status check sheet that can be deleted with thumbnails

I'm always confused, so I'll summarize it.

Premise

image.png

<input type=file name=logo_image /> <!-- (1) -->
<figure id=thumb_logo_image><img/></figure> <!-- (2) -->
<input type=hidden name=remove_logo_image value=on /> <!-- (3) -->
<button id=btn_remove_logo_img /> <!-- (4)-->

――Suppose there is such an element --If there is a saved file, the thumbnail will be displayed in (2). --Suppose you set thumbnails in (2) with JS immediately after selecting a file. -* Not sent to the server yet --Suppose that the saved file can be deleted by setting the value to remove_attribute name and sending it. --It is assumed that even if you send a new file with the value in the delete field, it will be properly replaced with the new file. -When the delete button of (4) is pressed, it is assumed that (2) thumbnail, (3) delete field, and (4) delete button disappear from HTML.

Washing out the condition

--Are there any saved files? --Whether a new file is selected or not --Whether you returned with the "Cancel" button after displaying the file selection dialog --Whether the delete button was pressed or not --Whether you selected the file again after the delete button was pressed --If you select a new file with a saved file, but cancel the new file

Identifying state variables

Status confirmation sheet

--Assuming that operation check is completed by repeating reloading and operation for this number of lines -* The cells null and false are omitted. Because it became hard to see

If there is no saved file

operation| (1) (2) (3) (4)
initial state
File selected Object inputValueUrl
After selecting a file
The delete button was pressed
After selecting a file
The file selection was opened again
Cancel was pressed

If you have a saved file

operation| (1) (2) (3) (4)
initial state savedValueUrl
The delete button was pressed true
File selected Object inputValueUrl
The file selection was opened
Cancel was pressed
savedValueUrl
From the Delete button is pressed
File selected
Object inputValueUrl
Since the file selection
The delete button was pressed
savedValueUrl
After the file is selected
The delete button is pressed
The delete button was pressed again
true
After the file is selected
The delete button is pressed
The file selection was opened again
Cancel was pressed
savedValueUrl

end

Ah confusing

Recommended Posts

File form status check sheet that can be deleted with thumbnails
Organize methods that can be used with StringUtils
[Ruby] Methods that can be used with strings
Summary of css selectors that can be used with Nookogiri
Create a page control that can be used with RecyclerView
Firebase-Realtime Database on Android that can be used with copy
Four-in-a-row with gravity that can be played on the console
SwiftUI View that can be used in combination with other frameworks
Summary of JDK that can be installed with Homebrew (as of November 2019)
Introduction to Java that can be understood even with Krillin (Part 1)
Set the access load that can be changed graphically with JMeter (Part 2)
Java file input / output processing that can be used through historical background
Simple slot machine implementation that can be used with copy and paste
About the problem that the server can not be started with rails s
Set the access load that can be changed graphically with JMeter (Part 1)
[Rails] "pry-rails" that can be used when saving with the create method
Performance analysis and failure diagnostic tools that can be used with OpenJDK
Ruby array methods that can be used with Rails (other than each)