Saving forms in a cookie with javascript. Help?

T

Tomas

I have a rather big form with many fields where some sub-selections change
depending on a main selection. Example could be continent, and if Europe is
selected the Country field is populated with only European countries.

I am no javascript expert, so I have modified some free scripts to get this
to work, and it does.

Since the selection process for what should be written into the fields of
the main form is so complex, I have designed a number of smaller "selection
forms" where the user selects his desired data which then is reurned to the
main form and entered into the appropriate field.

The two main scripts are these:

1. A script that can save and repopulate my main form to/from a cookie.
Works fine too.
2. A script that extracts data after it has been sent by another form with
this simple method:

<FORM ACTION="output.htm">
<INPUT TYPE="text">
</FORM>

(this is just an example, my forms are more complex)

Anyway, either script works fine when run separately.

1. Is invoked as follows: <body onLoad="restoreForm()"..
2. Is placed at the and of the html code just before the </body>.

1. must run before 2., or the restored data from the cookie will overwrite
data extracted from the other form. And that is also what seems to be
happeneing.

That was a long way to come up to the question: Which is run first, code
that is invoked with the olLoad command or code inserted into the body?

And how do I control the order they are run?
 
S

Steve Easton

Place or "nest" the function for 2 inside the function for 1.

function 1(){
do this;
function 2(){
do that;
}
}

--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top