what i am trying to do is to have one file with forms that can be filled out, some sort of setting page. When the form is filled out id like to display the input in another file. So one page to put the input and another one to display it.
I already tried to do it with .getElementById, it worked in the sense that i could display the input but only on the same page.
Thank you for your help
From what you have mentioned, you can use WebSockets . You cannot use selectors that are in a different page.
When you fill the form, send a message to server and then the server can emit the message. Just like a chat room.
You can use session variables to do that.
For example Once the form is filled user clicks on the submit button, that will sent the form elements (e.g.name,number,text,etc.) to the session variables using POST method.
And the session variables are accessed,modified throughout the session.
You can store form info into the browser local storage
localStorage.setItem('key', 'value') to create or modify data
localStorage.getItem('key', 'value') to access data
localStorage.removeItem('key') to delete data
localStorage.clear() to delete all data
Related
I want to add a special widget (e.g. in the start message) which will be have a Submit button. The user interacts with widget, then presses this button and the widget should add a result as a reply message.
The reply form sends a post request with some parameters. Where can I grab it?
Maybe there is a some plugin with such a feature?
I found these props as hidden form fields. I don't know how I missed them at first.
For feeds the similar information is stored in a global variable BP_Nouveau.
console.log(BP_Nouveau.activity.params);
I have multi paged form. And have to save inputs to cookie. and if i press next or previous button. I have to retrieve session dataHow to save each inputs value to session and retrieve them. And how to show back them each input.
Javascript
$.each($('input[type=number]'),function(){
alert($(this).val());
});
i think its gonna be like
sessionStorage.setItem('1',input1);
sessionStorage.setItem('2',input2);
sessionStorage.setItem('3',input3);
sessionStorage.setItem('4',input4);
Neither is particularly appropriate. Either send the form's data to the server when a page is submitted, and keep it saved until the whole form is submitted, or use localStorage to save data over pageloads.
I need to share the username and password information to the right next HTML page after succeeding the login. Because the items in the second HTML page will appear according to the user identity and privilege.
I tried sharing the same js file between the 2 HTML pages. The first set the variables and the second get them, but they don't get passed. How do I do it? javascript? jquery? on the server side??
Thanks in advance :)
It can be done in many ways, but as the first language you mentioned is javascript, I will show you in it. So saving data across pages there are variable called session variable and the process of saving/retrieving them is called session management. There are many ways for session management, one most common way is using cookie. You can save the values in cookie, like this:
setCookie("key", "value", expire_time(integer));
And now on next page to get this value you can use:
var val = getCookie("key");
Hope this helps.
Username and password is a sensitive information you have to share it form Server side in these ways:
Use post method to share this information.
Set session on first page For user type and retrieve on very next page.
As your question says second page will appear according to the user identity and privilege. You can set user identity (User Type) and its privileges.
Main problem is values written in input elementss disseapear after page reload (submit , refresh etc.)
I have a completed form ... /form element. Traditionally, I can insert a php line.
<input value="<?php if(isset($_POST['foo']))echo $_POST['foo'] ?>">
This solves the submit part. However, I feel that this is the worst solution, in my case. I have hundreds of input elements in my form. There are even some inputs to produce input tables. Number of input elements are so much that i became curious about finding a work around.
Is there a way to store input->values before the submit operation and inject them after page reload?
So that, the user can upload a file, file will be parsed by php core. And when the page reloaded both user originated inputs and file originated values are exist.
To simplify:
After "file submit & read & append file values to form", user shouldn't need to fill inputs that s/he already filled. I need an idea to achieve this, different then "inserting a php line to every single input element."
In such a situation I could recommend sending the file via AJAX and handling the response of that thereafter and then only injecting the values from the process and uploaded file when you get the response from the server.
Alternatively you could use localstorage or cookies to persist the information. However both local storage and cookies have a defined limit on what they can store. Cookie can only store 4KB in total which doesn't allow much.
Without uploading via AJAX, you could write a javascript function to find all inputs with jQuery/javascript and save their values in localstorage and on new page load to a check to see if there are any present and inject them back into the same inputs based on id/class/ etc with jQuery making sure to delete the localstorage values when done.
Hello I am working on multi step registration form and it contains file uploads in the intermediate step . I am storing each value in the form in the cookie to work it with browser back button and and reset the same in the final form which i want to post at the. But how to store the file upload in the cookie so that i can set it when user clicks on a browser back button. Also i need to submit it along with the final form.
You can't store a file in a cookie, you are going to have to store it on the server and keep a reference to the server within the cookie if you want it to work as you describe.
Something you could do is keep the entire form on one pageload and swap the content of a div dynamically. That way you could just hide the form elements you don't need, including the file form. A submit button at the end would take all the hidden inputs, with the file and post them all to the server.