Saving HTML with Checkbox states - html

I am writing a Perl script that is parsing a file into an HTML table which essentially contains classes and their information. The main objective of the script is for the user to check which classes he needs and the script will read which checkbox states are TRUE and only include those when creating a file that is like the original. Currently, I'm at the point where the HTML file opens in the users default browser, but if I check some of the checkboxes and save the webpage it doesn't save their states (tried it in Chrome and IE). Is there anyway to do this so that when the file is saved the user can hit enter in the program and have it do its conversion?

Related

Save As - html thymeleaf

we need to develop an application similar to the below
On the web page user is asked to select the parameters which are present in a Map<String,Boolean>. Once the user selects his choice of parameters then this Map is saved in a .DAT file. Right now I am saving it in C:/Users/Application. But I want the user to choose which directory he wants to save. I was tempted to use <input type="file".....> but it needs a file in the directory.
Is there any way that the user can specify his own directory where this .DAT file is saved.
Something similar to SaveAs..
A webpage cannot choose where the user will download a file that is returned. For some file types, the browser might even show the file instead of downloading it (e.g. PDF file).

Show previously attached file in HTML form while editing

I am writing a Django application where I have a HTML form to get a few inputs from the user. One of the inputs is an (optional) attachment file. The user is also provided with option to edit the form at some point in future.
When the user chooses to edit the form, the Django view returns the ModelForm and in the template I populate all the fields. But I am not able to populate the attachment in the file input tag. However, I can see that the form object has the attachment in it.
I found a few SO questions which asks for attaching a new file using scripts. And that is not possible due to security reasons. But I am looking for populating the file returned by the server on HTML page.
Is there a way to populate attached files with input tags?
No you can't do that. Instead what you do is provide a link to existing file and a separate input box for a new file in case the user needs it.

HTML5 drag and drop file, and upload on button click

I have been searching everywhere to find out how to implement the html 5 drag and drop file upload thing and I am still stuck with nothing. I tried BalusC's solution on how to upload the file to a servlet (HTML5 File Upload to Java Servlet). It works just fine, except that I can't send anything else along with the file. What I'm trying to implement is a form which takes both a file and a textual description of what the file is all about, like a "comment". When the user drags and drops the file, enters the comment and clicks "submit", the file must be uploaded to the server, using Servlets. With BalusC's code, the servlet is invoked, but if I try to display the "comment" (which I appended to the formData object), I get a null value. How can I append the comment to the data I send too? I like Vap0r's implementation too (HTML5 drag and drop and multiple file upload), but it doesn't work for me either. Help?

Save Winforms RichTextBox Data as HTML?

I have to convert an Access VBA app over to VB.NET and one of the text boxes (format set to RichText) on the VBA app accepts a straight paste from a Word document including its formatting and saves it to the Access database as HTML... The HTML is then read from the database and displayed as it was originally pasted when retrieved. The issue I have now is, I can use a web browser control to display the data properly from the database, but the RichTextBox gives an Invalid File Format error. When I wish to edit the data I switch the web browser control to the back and copy the data and paste it into the RichTextBox control and then bring the RichTextBox control to the front. This works fine, but once an update is attempted, the data gets saved in RTF format which is not HTML and then when I try to bring it up again from the database, the browser doesn't interpret it as it is not HTML. How can I save it from the RichTextBox, to HTML into the database like the VBA app can?
I've used this in C#:
Create a WebBrowser. Copy and paste the contents from your richtextbox to the webbrowser. And then read the html content (DocumentText) property from the webbrowser.
Edit:
Another way:
Use Office Interop, create a Word file, copy and paste into this file and then save as html.

Restoring the value of a input type=file after failed validation

I have a form with several inputs that deal with files. The javascript validation is pretty good at checking to make sure that everything is good, but some things require PHP to inspect (like the file's mime type), and sometimes it will get rejected.
The problem is, when I send the user back to the form, I can repopulate all the data that they had originally input, except the inputs with the type of file. Firefox doesn't provide the absolute file path so I can't just copy in a file path to the input.
What can I do to repopulate the input type=file form elements?
You cannot populate the file input, to do so would be a serious security problem.
Instead, store the uploaded content on the server and store an id that you can use to reference it in a hidden input.
Clean the files up automatically after they reach a certain age, and provide a means for the user to change their mind about what file they want to upload (e.g. a checkbox (checked by default) for each file being stored on the server for upload)