Internal web page to retrieve, save and store information? - javascript

(I apologize for any incorrect lingo)
I am creating an internal web page as a sort of intranet for me and another associate to use in our department to keep track of information. I have created "pages" using HTML to navigate and saved in our department folder. Doesn't need to be flashy just functional.
I have a table with 5 columns of information for each item we need filled out. I have created a pop-up window and form for these 5 columns to open and the idea is that when the the user (me) fills the form out and clicks the submit button, the information is transferred to the parent page, saved and stored for later tracking.
I'm assuming this isn't possible by just saving .html files into our network folders. I think i might need a database to "save" the information the user filled out.
I wouldn't necessarily need the window pop-up..
Is this way over my head?

You would at least need a server side language such as PHP. Using a Database is highly recommended.
In my very humble opinion - Yes, it does sound as if this is over your head right now.
Recommended readings:
http://www.amazon.com/s/ref=nb_sb_ss_c_0_3?url=search-alias%3Dstripbooks&field-keywords=php&sprefix=php%2Caps%2C129
Let me know if my answer is helpful.

Related

Passing product id between pages

I have a problem, I am writing a system for an company and I want it to be as secure & robust as possible, but now I'm stuck.
I have a product list, where a logged-in employee can edit, delete or emit (print) specifications about a product.
Let's assume I'm a logged-in employee on that system. When I click a product from the product list and then click on emit (print), javascript will send data over POST to the next page (Yes, it must be JS, because of the design of the page).
So the next page is displayed with correct info about that product (because POST passed the product id to the next page, which then realized an SQL query and fetched all info).
Now, on that page, I can verify if all info is correct and then click again on emit (print) to finally print the specifications. But here I came across a caveat: How will the next page know the product ID? I can't use POST, because there's nothing to post..
Cookies are designed for such stuff, but I think that when I'm logged in two tabs on the same browser and then click print on both tabs at once, the same Cookie will get called twice and overwritten twice (conflict), and, consequently, product id's could get swapped.
$_SESSION I believe I can't use too, because if two users are logged on the same Machine, data could get swapped too, just like in cookies.
Now, what is the 'best' practice to pass data between pages that "supports" multiple concurrent users on the same machine, and even in the same browser?
This somewhat similar question solved my problem:
Any way to identify browser tab in JavaScript?
This way I can create an unique "emitID" for that tab and then use that to take track of the current product id.
Also thanks to #SteevePitis for pointing me in the right direction.

PHP passing session id between different devices

My problem is simple.
I have two users on two different devices accessing the same servers pages (page 1 and page 2 respectively ).
I want to use php forms in one page to change the second users page.
(i.e. 1st user on page 1 presses a button and changes the image on 2nd users page 2 , on a separate device).
I thought I could do it by using the 2nd users session ID in the form on the 1st persons page, and fool the server to reload the 2nd users page with the updated info.
But i can see no example of it anywhere on the web. Is this possible or should I just use Ajax?
Thanks for any help.
I would suggest not hacking Session ID's like that, they're meant to identify a single user.
If you want data shared between users it's likely you'll be well served using a database, such as MySQL as commonly runs along PHP.

Save current page view for sharing

Say I have a java/spring/jsf/jsp web application. User fills all required fields, chooses all the options, clicks generate report, spring beans do their job, database is queried for information, and user is directed to a "report" page generated according to entered information. I am looking for a way to save that page to be accessed later by link - kind of a share current page link. One example of this might be jsfiddle.net where you can enter information, save it and get a shareable link.
What i thought of, having my current knowledge, is saving some kind of url extension hash along with currently displayed page properties to database and query database for that information when someone accesses www.websiteUrl.com/extensionHash but making a query everytime someone accesses the extension seems kind of heavy on performance. Another way could be saving whole html page or just the content part on the server and serve later on request.
What is the most simple/productive way of doing this?
This is one option instead of link :
What you can do is you can load the required data for that report from database when your application starts, put the data in Application Context ( ServletContext in Java ) and whenever you want to get the information, instead of making a database call, you get that from Application Context.( so basically its like you are loading from cache) this way your perfomance is improved.
in java, You can achieve that by implementing a listner class.
Downvoters : please specify the reason.

Is it possible to collect data from one page and autofill it onto a form on a different site using JS/jQuery?

A site I am working on requires user information to be collected from a form when the user presses the submit button. The site will then take the information and plug it into a more robust form on a different page, so the user does not have to retype the information twice.
Is this possible using javascript?
Any help appreciated.
Once the user leaves the current page, the JavaScript on the original page is no longer running, They will load up the other page and run that page's JavaScript.
Do you have ownership of both pages?
If so, then you can leverage the form GET to pass information across pages, so the next page will have a Query string, and JavaScript can parse that.
Another way to move data from one page to another is to use Cookies. So it really depends on how much data you want to move around.
But I highly recommend that you leverage the server-side technology to handle the form GET or POST and carry information across pages.
This completely depends on the OTHER site. You can have a form with the same field names and post it to the same URL the other site's form uses.
BUT - if that site checks to see where the original post came from, it may block you out.

Storing Field Values With Local Storage

I have a web app that I created to ease submitting sites to directories, but I have a bit of an issue. Whenever I close the window, the fields go blank and the checkboxes get unchecked. What I've been doing to work around this is just hard coding the site information every time and adding a checked value to the checkboxes in the HTML before closing the page.
What I would like to do is use local storage to store the value of these fields, with "save" and "clear" buttons. Unfortunately every time I've looked at cookies, my head explodes. I'm just using 7 text fields with separate names, and 40 checkboxes with separate names. I'd really appreciate any help I can get with this.
http://bearce.me/seo/
Cookies are not a good mechanism for storing form information, not least because they can be intercepted by anyone between the server and browser (Man in the middle attack).
Another reason they are not suitable is that they are not designed to hold large amounts of data, so if the user has entered a large amount of text, it will be lost.
Think about using local storage - this is what it is for.

Categories