From: ViLco on
Hi, I'm starting to use ajax in these days and I'm building a test web
application.
It will be based on javascript on the client side, asp pages and a
XML-consuming DLL on the server, where the DLL handles data acces,
calculations and such.

Now, imagine that I'm in a form where I asked for a certain record, the
request went to the server and the server rrepondend, javascript received
the XML from the server and deserialized it into the various <input ...>
tags, showing all data as expected. If I click F5, or the "refresh/reload"
button of the browser, my form refreshes to the state it was in when I first
reached it: any form data gets lost, the form lokks just like it was when I
first got there.

What are the preferred methods to retain the form data, in this scenario?
--
Vilco
And the Family Stone



From: Giacomo Ritucci on
On 14/07/2010 12:29, ViLco wrote:
> Hi, I'm starting to use ajax in these days and I'm building a test web
> application.
> It will be based on javascript on the client side, asp pages and a
> XML-consuming DLL on the server, where the DLL handles data acces,
> calculations and such.
>
> Now, imagine that I'm in a form where I asked for a certain record, the
> request went to the server and the server rrepondend, javascript received
> the XML from the server and deserialized it into the various<input ...>
> tags, showing all data as expected. If I click F5, or the "refresh/reload"
> button of the browser, my form refreshes to the state it was in when I first
> reached it: any form data gets lost, the form lokks just like it was when I
> first got there.
>
> What are the preferred methods to retain the form data, in this scenario?

You could:

* craft a querystring-like hash fragment and save it in window.location.hash

* or use window.localStorage

then, when you load you form you can check these places for values. If
they are not there, ask your server.

Bye,
Giacomo
From: Evertjan. on
ViLco wrote on 14 jul 2010 in comp.lang.javascript:

> Hi, I'm starting to use ajax in these days and I'm building a test web
> application.
> It will be based on javascript on the client side, asp pages and a
> XML-consuming DLL on the server, where the DLL handles data acces,
> calculations and such.
>
> Now, imagine that I'm in a form where I asked for a certain record,
> the request went to the server and the server rrepondend, javascript
> received the XML from the server and deserialized it into the various
> <input ...> tags, showing all data as expected. If I click F5, or the
> "refresh/reload" button of the browser, my form refreshes to the state
> it was in when I first reached it: any form data gets lost, the form
> lokks just like it was when I first got there.
>
> What are the preferred methods to retain the form data, in this
> scenario?

You would not want to use ajax,

Just use ASP-Javascript serverside code
to populate the <input>s on a per session base
when refreshing via form post.

<input value='<% = theName %>' name='theName'>

This is guaranteed cross-browser compatible.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
From: ViLco on
Evertjan. wrote:

>> What are the preferred methods to retain the form data, in this
>> scenario?

> You would not want to use ajax,
>
> Just use ASP-Javascript serverside code
> to populate the <input>s on a per session base
> when refreshing via form post.
>
> <input value='<% = theName %>' name='theName'>
>
> This is guaranteed cross-browser compatible.

Thanks both to you and Giacomo
--
Vilco
And the Family Stone