I was looking around trying to find a solution but was unable one. What I want is the take whatever the user enters into text fields and save those into an xml file. Then I want to prompt the user to save that file.
What I mean is to get the info from many different input fields through document.getElementById('id').value and put that into the file.
For example:<lessonname>document.getElementById('lessonname').value</lessonname>\n
Related
In my app, users can fill a form (all kinds of inputs, including file inputs). At any point and after posting that form to backend, they can edit the form. In that case, the text/selects/numbers... are set to the value entered by the user previously.
What would the best practice be for file inputs ? I know I can't "preload" them for security reasons.
These files are stored on the backend. I need to find a way to figure out :
If the user hasn't changed the file
If the user has changed the file
If the user wants to remove the existing file (if possible ?)
I am trying to make a user-friendly Python program where the user enters the input in an HTML file instead of calling the functions from the console. One of the inputs is the directory of the dataset. because it is friendlier to show the user where he or she is choosing as the dataset path, I am using <input type="file">. however, I understand that for security reasons browsers won't return the full path of a folder but I was wondering if there is a way to get the full path when the server and the client are the same which is as friendly as <input> option.
i am working on javascipt ,i want the data which is entered by the user in textarea get save in some txt file in my system in some specific folder. can anyone please suggest the solution of this problem in javascript code or jquery .
JavaScript cannot access file system of user. So, you cannot store the data entered by user in his system.
I want to create an HTML form on the Server. When the client completes the form and clicks submit, I want to be able to save HTML form and data in a single HTML file on the server.
The best suggestion I have seen is using JavaScript. Use a client side script that on click will save the document.InnerHTML to a var that can then be submitted back to the server.
Is this the best approach, or is there an easier way?
Even though I have no idea why you want to save the whole html code because I'm sure there will be parts that are the same for every user and you will be wasting memory, but ok.
So there are two ways to do this:
1. is javascript as you said
2. would be to put all the generated html code into a hidden form input (already on server side)
the first one seems more comprehensive and this is what I would do but the second one would also work for users with js disabled.
I wouldn't really recommend this way, because I'm still a huge fan of saving data in a database, but here's a general outline of what to do:
User fills out the form and submits.
Server-side code executes a method:
a. String holding the template for your HTML page with placeholders for the fields.
b. Use String.Format to put all the user input into the correct places.
c. Create a file, write the string to the file, and save.
d. Return file name to user.
HTML files are not that large, but still you risk using up your hard drive space. Also, you need write permissions which introduces security risks.
Going the database route:
1. User fills out the form and submits.
2. Server-side code saves the data to a database, and returns a link (with querystring string of ID and possibly a user id to help with security) to the user.
3. Whenever the user goes to the link, the server-side code repopulates the form with the ID passed.
I need to create a CSV File editor. The user should be able to upload a CSV file, and the data should automatically be loaded into a text area. I have seen many examples of CSV data being transferred from a text area to, for example, a table, but I can't find something that will help me with actually uploading a file, reading the data from it in to a 2D array, and then placing it in a text area.
I can transfer the data into an editable table from the text area without problem.
So the question is: How can I upload a file, read the data from it (and keep the format of the CSV) and display the correct format in a text area element?
I am not currently concerned about checking to see if the CSV is correct etc etc. I just need to know how to handle the data. Sorry, but my Ajax knowledge is very limited. Any help or guidance would be appreciated.
Uploading it is no different than how any other form works in HTML.
You can use a file input to select a file, then upload it as part of the form data (it's automatic) or supply the user with a textarea to paste into. Submitting the form will "upload" the data to the server. You don't need AJAX to do any of this, but it is an option.
What you do with the data on the server is up to you.