Remeber file selection - javascript

I have a form which asks to select a file for upload. PArt of the form requires the user to click through to another page. This is fine as I can store field values in local storage. The problem is the file selection - is there a way to remember what the user selected once they navigate back to the form?
If not can anyone suggest how to implement what I am trying to do?
Thanks

So as you are not posting some code examples, I assume that your are not interested in code suggestions.
You could use a session to store some data the user gave you over a form. CakePHP comes with the nice session helper, which makes it easy to deal with.
How to use sessions with CakePHP you can find here:
http://book.cakephp.org/3.0/en/development/sessions.html
So everytime the user fills out the form you could store the relevant data inside the session. Inside your view you just check if there is a value for that data in your session. If yes render the session value as default if not you can render the default value.

Related

How can I make an HTML/NodeJS form go to another form based on a response, sort of like Google Form's "Go to section based on answer?"

So I have a NodeJS site and on the home page is a form containing some radio buttons. When the user clicks "Submit," I would like for the user to be redirected to another page based on the answer. This I have figured out (The buttons have an onclick attribute that changes the action attribute of the form element). However, I need to keep the data from the original form, so that after the user has "chosen their path," I know what path the took and the answers they made along it. Thank you in advance!
You could persist the client's state in a session. If you're using express, one alternative could be express-session. The way it works is that it assigns a unique identifier to the user in the form of a cookie and saves the data somewhere (memory, database, a file, etc. depending on which you choose). Then when the client makes another request, the server gets that data back with the identifier from the cookie.

Storing Javascript object in Wordpress User Database

I am working on a page where user can create his own unique , personalized week schedule.
Right know all about the schedule is stored in javascript object - scheduleArray.
Here is the site with my work so far
How can I store this javascript object to logged user database in WP?
I need to load it from database on site init, and later when user clicks "SUBMIT" button store it back to database.
Could you provide me any ideas, tutorials from which I can start on ?
Thanks!
As one way - add field (maybe something like next https://tommcfarlin.com/add-custom-user-meta-during-registration/) to user profile and store JSON here.
When yser submit form - you can create hidden field with this (by "onsubmit" event) and write to user field by server-side script.

Trying to save Multi-Value Form on server for users to call up during another session

been searching here for a while on how to save form information to be re-called later.
Here is my site: http://d3barb.com
The purpose is people fill out the 100+ fields in the form and it will generate numbers corresponding to the game Diablo 3. The formulas all work perfectly, and sometimes the cookie will save the information, but I'm trying to figure out a way to save the entire "page", so users can call them up during a different session.
I've tried for about 6 hours to get setCookie / getCookie functiond to create a cookie with all the values saved, but can't seem to get it to work. Even if it was working, it would only allow the user to load their last seission when re-visiting the site.
How I would like it perform:
1.) User inputs information for the form to calculate.
2.) User fills out a "name" text field and hits a "Save" button (I have these on my test page, but don't want it live until its working), which will save the values on my server containing all the form information as they've entered it.
3.) The next time that User visits the page, they would hit "Load" to call up a previous session.
I'd like to avoid user-account log-ins, so if possible I'd like the server to save the sessions by IP address & user submitted session name, something like: 142.105.103.125.fire crusader
Currently, the page is html with js calculating everything. I can convert it php for server interaction, but if there is another way, I'm all ears.
I'm not looking for handouts, so any links to tutorials would be greatly appreciated. If someone has done something similar to this and wouldn't mind sharing that page or code with me, I can do my best to frankenstein it for my page. (pretty much how I do all my websites haha!)
Have you tried/considered HTML 5 local storage?
http://www.sitepoint.com/html5-web-storage/
should get you started :)

Front end form submission

I've been looking around and haven't been able to find an answer to this.
I have a form that has to be submitted and the data to be processed entirely on the front end(in javascript). Is there a way that I can pass the form data to an action page and not to the same page. Right now I'm just emptying all data in the section and replacing it with the data that is being called; but I would like to do this similar to how a form would interact with php or python.
Thank you
-Art
What you could do is use HTML5 local or session storage to store all of the form values that a user enters and then on the new page use the stored values as you require.
http://diveintohtml5.info/storage.html

Javascript A thank you page with user name on it

I have a form where a user input name and other contact information. I validate the input and then redirect to a thank you page. I wanted to personalize the page by having the user name appear as part of the thank you note. I tried document.getElementById(Name1).value to retrieve the value of the Name but it it is giving Undefined.
Is there a way for me to set the value of the Name1 field to another variable that I call again to include it in my text message?
You are getting undefined because in the thank-you page, you don't have the form anymore.. the best way to do it is on the server side.
If you insist on doing it completely on the client side, then you might need some hack. One idea is to use window.location.hash as #MateiMihai mentioned. Another idea is to use local storage which saves values on the client side. This can be helpful: http://www.jstorage.info/

Categories

Resources