Forum Moderators: open

Message Too Old, No Replies

holding onto dynamically built data

         

natty

4:00 pm on Mar 12, 2003 (gmt 0)

10+ Year Member



sounds flashy huh..

i have the problem that i have some JS dynamically built dropdowns, as from my prev post..
but when the user (we will call them gits from now on) submits that page, and then goes back cos they have screwed up, none of the values in the dropdowns have bee held..
EEEEKK! more blooming work

is the only way round this a cookie and something in the onload?

cheers again.

nathan

txbakers

4:43 pm on Mar 12, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I maintain state through ASP code. If the user submits the page all the form elements values are kept in the Request object. You can capture that in your form if you want to.

I frequently do this:

<input type="text" name="Username" value="<%=Request("username")%>">

This will cause the field to be blank the first time, but will retain their entry should something happen to cause the page to reload.

You can do the same with select boxes, but it's more complicated. You need to capture the Request in a "hidden" variable, then compare the value with the options in the select box.

But it's very doable, and once you have it you can copy and paste to your heart's content.

AmishJohn

5:03 pm on Mar 12, 2003 (gmt 0)

10+ Year Member



I have done this by copying the dynamic page (using the "innerHTML" property to another window (frame or secondary window) and then retrieving the copied data (again using innerHTML) when the dynamic page is reloaded.

It works well on IE4 and up and on Netscape browser that support innerHTML (6 and up).

natty

5:53 pm on Mar 12, 2003 (gmt 0)

10+ Year Member



asp sounds cool , apart from the fact that im using perl on apache. :) and use cgi::persistent to maintain a state.
which is no help as it cant do inline substitutions like asp and php and stuff.
i may try the hidden popup route, but i think we may just use cookies..
is there really no other way?
being as it the JS that will have to refill all this stuff anyway..
/me cries in a corner.

cheers again ppl

nathan

HocusPocus

7:18 pm on Mar 12, 2003 (gmt 0)

10+ Year Member



I would abandon the JScript/Cookies/hidden windows route and write it in Perl. There's plenty of free perl scripts out they that can easily be modified to be useful for your site.

Allen

12:10 pm on Mar 13, 2003 (gmt 0)

10+ Year Member



There's always PHP sessions :)

Allen

natty

1:10 pm on Mar 13, 2003 (gmt 0)

10+ Year Member



lo, if only i had the opertunity to do that.
the spec is to do all these dropdown things in JS. so that the user does not have to wait to get the times from the server. aparently .. are users really this impatient when they are about to spend money?
who knows..
so i am starting writing some JS to stick the dropdown values in a cookie, and then read them back in, in the onload of the page, which does trigger on a back button press, or at least it does for me :)
means then writing more stuff to get the existing functions to take this new stuff, but hopefully nto too much work..
if only these pm chappies think of these things at the beggining my job would be alot easier..

thanks again ppl
yours, with a big sigh..
nathan