Solved

Save Form Date before reload

Posted on 2010-11-24
4
347 Views
Last Modified: 2012-05-10
i need a way to save the form data before the form is submitted or reloaded. I have a filter that opens in another window and thenrefeshes the form and then loose the data that is already entered.

My guess is to save each form element to a cookie. I dont know javascript so how is the best way to do this.

I need a code sample please.
0
Comment
Question by:garyilm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 28

Accepted Solution

by:
sybe earned 500 total points
ID: 34205763
You can do it just by javascript. From the new window you can refer to the original window with: "this.opener.document". Then you can read the values entered in the form. No cookies needed (that would also be much more complicated and have some disadvantages).

That having said: why does the form need to be refreshed? I am quite sure that there is a simpler solution that will avoid the problem that you have.

0
 

Author Comment

by:garyilm
ID: 34205802
On my main page I have a form, one of the elements is a drop down. I then have a filter link that opens the child with the filter. Once the filter is set it closes and refreshes the parent.

0
 
LVL 28

Expert Comment

by:sybe
ID: 34205955
But you only need to change the options in the dropdown? You might want to use ajax to do that. That will leave the rest of the page untouched.

You could also write the filter in javascript in the page itself. Or you could have two connected dropdowns where the first picks the filter and the second shows the filtered options (that works only is the filter options are fixed, like dropdown1 = state and dropdown2 = city.

0
 

Author Comment

by:garyilm
ID: 34206003
Ajax would be the better option but I cant reinvent the wheel on this project.

From your first post I have this
<script langauge="javascript">
function post_value(){
  document.frm.c_name.value=opener.document.myForm1.location.value;

}
</script>

What is the code to set a cookie, something like this

 Cookie(namelocation)=opener.document.myForm1.location.value;

0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question