Node js data retention - javascript

There are two forms on a single page, one for sending data and the other for entering pieces when clicking on the product.
That is, when I click on the product, a modal opens and I enter the number there, but I do not want the data in this modal to be sent immediately, I want it to be sent with the product information, how can I do that.
I am using mongodb as database.

Related

Dropzone remove files if refreshed or tab is closed

I am trying to use DropzoneJs.
I have a form with some text fields and a dropzone for file attachments. I did it so that after a file is successfully uploaded to the server (after being automatically processed by dropzone), I'll just add hidden input fields with the filenames as value along with all the other textfield data in the form (for database). However if I have dropped files in the dropzone and has been successfully been uploaded to the server, and for some reason the form won't be submitted (eg. page refreshed or tab closed), then there won't be a need to save the filenames into the database. How do I remove the files in the server just before a page refresh or tab closing?
1) A good idea to do these kind of things ( at least how I do it ), is that you save all the images immediately ( with filenames ), and when the user closes the page and gets back to it in a while, they all show up again. So something like this:
Let's say you have a table users and a table images. When he uploads images to the server, they will be saved in the server and in the table images even without submitting the form. When the user closes the page, and gets back to it, he will have all the uploaded images again.
2) If you don't want this kind of thing, in the images table you can add a column with the name "draft" or something like that, so when the user uploads pictures, all the images are drafts, and when he submits the form, then they all become un-drafted. So with this, when users close the window, images are still drafted and nobody won't see them.
With this, you can then run a "cronjob" that deletes all the draft images from the server, or you can do that on the user's next login.

Pop-up, when data already saved

I have a problem with the pop-up:
This page is asking you to confirm that you want to leave - data you have entered may not be saved.
I am using JavaServer Faces and JavaScript, and after navigating away (and saving every data that I need) if on the next page I click on any button, I see the pop-up. So it doesn't even appear on the page when the data was given, but on the next one, where I have just a few buttons to select the next action.
Does any easy way exist, to find out which part of the data is not saved?

How to submit dynamically generated form with multiple levels of tabs and modules in PHP?

I have a registration form of residential complex with multiple levels, as you can see. I can edit and generate tabs by JS and jQuery, however I can't get the idea how to pass all that info to DB.
Screenshot:
How can I submit all that information into my MySQL DB from this form which generates dynamically?
How to correctly generate tabs (when press + button)? I mean using arrays $floor[0] and etc.
Do I submit it by parts, or I can do by 1 submit button, as well as on the screenshot?
The better solution is to use jquery wizard form.
Click Here for demo. you can store your data in single table and get all the data at the end of form submition.
As per my comment...
You can store all information in one database table.
After clicking on submit button from tab 1 the action perform to redirect to tab 2 and get all the values of tab1 to tab2 but make them hidden. Note: you can store all previous values in session or any other ways.
As like for tab 3.
After clicking on tab 3 submit button your sql query runs which insert all the values in database table.
Hope this will help you.

How to create a List in a website, when a user clicks on several Divs?

I am working on an ASP.NET MVC 3 ASPX website. I have created a View called Index and this View is responsible to generate a number of divs of different colours, which afterwards are supposed to be used by a user. The user will be presented with a number of clickable areas (divs), which change colours on mouse click. This I can do easily in Javascript. The problem is that down the page I have a submit button, which has to take all the data from previous input fields and also a list of divs that were selected by the user and send it further to my C# code.
I have no idea how to create this list and keep it until user sends it further to the C# code, because I suppose it should be Javascript that keeps this list. Otherwise, it should be C# code on the server that gets an integer describing which div was selected every time a user clicks on a div.
What is the easiest and most elegant way to create this list of div indices and send it further to the server, when all data (also other input fields) is combined?
This is my sketch explaining the structure of my website:

Adding multiple records to database from HTML form having some common parameters

I have a web page which has a 2 part form. Tech used: JSP, HTML, SQL server
In first part the user would enter some basic info which would be common for all records he is entering in the current bunch. Then on clicking next he would be redirected to a page where he can go on to add specific information for each record in the batch - with options to 'submit and add another record' (redirecting to same page, and only needing to enter the new record specific fields) or submit all records entered.
So I will need to constantly hold the parameters from the initial page and keep forming multiple 'objects' till the user clicks submit, which would call a method in JSP/JAVA class to insert the records.
------Page 1 | Basic Information ------
------Page 2 | Per Record ------
One way would be to keep forming and appending a query for each record and storing in a hidden field passed through the pages and pass through method on click of submit.
Can someone suggest a better method of how to handle such a situation?

Categories

Resources