---
Start by creating a clear and concise explanation of what you are really
trying to achieve.
---
Okay, let me try again (I was afraid that I would scare people off if I
went into details). I am trying to recreate a web page that I made
using PHP and javascript (see
http://www.u.arizona.edu/~avr/umc/tpn/).
Most of the work for this page is done with javascript except for a few
details. Currently, index.html gathers the information entered on the
first form and pass the information onto another TPN.phtml which
displays the next form in slightly different forms with different
options depending on what the user selected on the first form. So what
I would like to do is have one html page that has a long javascript take
care of everything instead of having 2 seperate html pages. So in order
for this to work, when my new page newPage.html loads, it needs to
display the first form (currently index.html). When the user fills in
this first form and hits submit, I want the same page (newPage.html) to
reload and display one of several forms depending on the choices the
user makes in the first form. The area I am getting stuck in is how to
have the same page display this first form, then have the user hit
submit, and have another form pop up which uses information from the
first form. So far when the user presses the submit button, I keep
getting that first form to come up and am not sure how to not have it
come up.
Now that we have gone complex...to make things simple again. I would
really like to see one html page with one javascript that displays a
text field and a submit button. When the user hits submit, if there is
something in the text box I want an alert box to display #1
$textFieldEntry and for the form to redisplayed with an html line that
says submit hit once at the top. Now if the user types in something
else and hits submit, I want the alert box to pop up and say #2
$textFieldEntry and display an html line that says submit hit twice at
the top of the page. So each time submit is hit, I want it to call a
different funtion, how can I have one html page that calls a different
funtion depending on how many times the submit button is hit? I would
really love to see an html page that does what I described above,
because this would get me past this block that I have.
Thanks for all your help, sorry if I wasn't clear before.
-Andrew V. Romero
Richard Cornford wrote:
"Andrew V. Romero" <rr*******@icqm ail.com> wrote in message
news:3F******** ******@icqmail. com...
First off, I am mostly familier with PHP but am
trying to make a multi-step javascript program.
You probably know exactly what you mean by "multi-step" but if you don't
explain no one else will. (in one sense of another all programs are
"mult-step").
For an example, I would like to run different sections
of the script depending on how many times the user
presses the submit button:
<snip>
Given that pressing a submit button will submit a form and (if
JavaScript is enabled/available on the client) activate the onsubmit so
each onsubmit handler could assign a reference to a separate (the next)
function to the forms onsubit handler for execution with the next
submit ckick. Though the user wont get a chance to click the submit
button that many times before the browser starts to load the response to
the form being submitted by the first click (assuming submission was not
cancelled).
I keep running into problems...for example, javascript doesn't
have an isset command that I know of,
I can only guess as to what isset does but:-
if(typeof globalVarName != 'undefined')
is probably the sort of thing you are after.
so I can't just use hidden elements to
determine what part of the script to run.
The desire to use a hidden for element implies wanting to persist
information across multiple pages, otherwise why not use a global
JavaScript variable.
I tried using form method get to use variables
in the location to determine which parts run, but I am
not sure how to pull the variables out of the location bar
using javascript.
location.href
-or-
location.search
I think I am trying to make this more complex than it
is...what is the best way to go about this?
Start by creating a clear and concise explanation of what you are really
trying to achieve.
Richard.