Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Save Form Date before reload

Posted on 2010-11-24
4
Medium Priority
?
349 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 2000 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

721 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