theClerk Posted July 29, 2019 Share Posted July 29, 2019 (edited) I'm creating a web-based app and it's built on HTML, CSS, JS. I need to use JS to add the values entered in various text, checkbox, and drop-down inputs on different pages and display an output on a different page. I'm not sure what JS code to utilize for this. Basic scheme: Data inputted on 20 pages is added up or averaged, and the result is to be displayed on one summary of data page. I saw some code (see below) that does something similar, but not exactly what I need, as it does not explain how data from specific fields on various web pages can be added or averaged. I imagine I'd have to incorporate the link address of each page into the JS formula so it can know where to pull the data from. Any ideas? Edited July 29, 2019 by theClerk Had to replace image + add an image Link to comment Share on other sites More sharing options...
justsomeguy Posted July 29, 2019 Share Posted July 29, 2019 Javascript running in a browser only has access to the current document. Trying to do anything else would be a series of hacks. You could put a bunch of hidden iframes or something on the page to point to different pages if they're on the same domain and try to access things through that. A much simpler and more useful solution would be to store your data in a database instead of in HTML files. Depending on what the purpose is, you can save the various values in localStorage or sessionStorage to access on other pages. 1 Link to comment Share on other sites More sharing options...
smus Posted July 30, 2019 Share Posted July 30, 2019 justsomeguy is right, if you have complex data, better to store it in a database, server-side or client-side. Even HTML5 (using JS) has a way to store data called webstorage. Choose the way that suits you best 1 Link to comment Share on other sites More sharing options...
theClerk Posted July 31, 2019 Author Share Posted July 31, 2019 On 7/29/2019 at 5:03 PM, justsomeguy said: Javascript running in a browser only has access to the current document. Trying to do anything else would be a series of hacks. You could put a bunch of hidden iframes or something on the page to point to different pages if they're on the same domain and try to access things through that. A much simpler and more useful solution would be to store your data in a database instead of in HTML files. Depending on what the purpose is, you can save the various values in localStorage or sessionStorage to access on other pages. Thanks, justsomeguy. I'll look into this. Link to comment Share on other sites More sharing options...
theClerk Posted July 31, 2019 Author Share Posted July 31, 2019 @justsomeguy, what database would you recommend? Link to comment Share on other sites More sharing options...
justsomeguy Posted July 31, 2019 Share Posted July 31, 2019 It might depend on your environment. If you're using Microsoft servers with .NET on the backend, then you might have SQL Server available. If it's a server with PHP on the backend then MySQL/MariaDB would be most popular. Link to comment Share on other sites More sharing options...
theClerk Posted July 31, 2019 Author Share Posted July 31, 2019 I understand, @justsomeguy. Now, a primary feature is this form needs to be accessible to multiple people simulteneously and savable with different filenames. I trying to figure this out too. BONUS QUESTION: We need a text input header area, wherein text inputted will populate across pages (if we continue the HTML files route). Link to comment Share on other sites More sharing options...
justsomeguy Posted August 1, 2019 Share Posted August 1, 2019 Any database supports multi-user access, the database will let several different applications connect at once. savable with different filenames I don't know what you mean, what are you saving? We need a text input header area, wherein text inputted will populate across pages That's what a database is for. Have page to update the header text in the database, and the other pages should get the text from the database and display it. 1 Link to comment Share on other sites More sharing options...
theClerk Posted August 1, 2019 Author Share Posted August 1, 2019 2 hours ago, justsomeguy said: Any database supports multi-user access, the database will let several different applications connect at once. I don't know what you mean, what are you saving? That's what a database is for. Have page to update the header text in the database, and the other pages should get the text from the database and display it. That all sounds good to me. I'll look into it. Thanks, @justsomeguy. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now