How can I create a email form which allows user to specify:
- To
- Subject
- Attachments with Add/Open/Remove facility
- send/cancel button
I'm having trouble to send the index of the file the user want to remove , for example if the 开发者_如何转开发user attached file1, file2, and file3 in the email submission form and I captured this info in the controller as key,value pair where key is index and value as file name. But the user is allowed to remove arbitrary file before sending the email, for example the user clicks 'file2' remove button. Now in the controller I want to grab the index of the file need to be removed, but this is dynamic since user can click any of the attached files remove button.
I'm using spring 2.5 with JSP/JSTL as view component.
Please see the sample email form:
To |_________________| Subject |________________| Attachments: [**ADD**] **X** file1 **X** file2 **X** file3
(click the 'ADD' button to attach file, click 'X' to remove corresponding attached file,click on the file name to view/open the file contents)
If removing is handled at the server side, you can implement remove buttons as a <button>
tag, where name
is, say, fileToRemove
and value
is an index of the file. When user click that button, the form is submitted with fileToRemove=...
parameter:
<button name = "fileToRemove" value = "${file.id}">Remove</button>
Thanks Axtavt, but we are using IE6 as client browser and the following is known issue:
Meanwhile, the button element allows authors to produce buttons that submit data to the server that does not match the text displayed on the button. Delete should submit to the server row_to_delete=1 but Internet Explorer will send row_to_delete=Delete. If IE could be persuaded to behave, then this would also be useful for multilingual sites – the text displayed could be translated for each language, but the value could remain the same so the server side logic wouldn’t need to check the translation table. It gets worse though, Internet Explorer 6 has a further bug where it will treat all elements as successful controls, and submit their data to the server, even if they were not clicked. This effectively makes using multiple button elements impossible.
精彩评论