Jump to content
Sign in to follow this  
theClerk

Add and average date from text input on different web pages

Recommended Posts

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.

image.thumb.png.381a78c107b85305275323e4a9096619.png

 

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.

image.png.9ee4f59459b7edc110a71f6842d090e6.png

Any ideas?

Edited by theClerk
Had to replace image + add an image

Share this post


Link to post
Share on other sites

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.

  • Like 1

Share this post


Link to post
Share on other sites

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

  • Like 1

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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).

 

Share this post


Link to post
Share on other sites

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.

  • Like 1

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...