help148.txt == To make help148.htm I think.
Hi again Phil,
Thanks once more.
I've taken your advice and written two simple pages, based on my
existing pages.
The FORM1.html (below) page runs fine. It validates, submits,
cancels and resets.
Order Form
(I did try applying your use of var Rtn = true/false, both with and
without the following else ... return Rtn. With both I had a
problem with the validation. If I left the name box empty and hit
submit the error message would display, but then immediately change
to the submit "popup" without chance of making an entry in the name
field. I couldn't understand why.)
THANKS.html
Thanks
What I'm wanting to happen : When the user clicks the submit button ...
1. the form is validated using the validateForm function, before
displaying the submit or cancel option.
2.if the user clicks OK to submit the form, the form is submitted and
the confirmatory page (thanks.html) is displayed, replacing the form.
3. but if the user cancels the submission, then the submission is
cancelled and the completed form stays displayed.
My attempts at a submitForm function have resulted in - if a field is
missed/wrong it displays the error message but then immediately goes
into the submit function. (exactly the same problem as above)
These are the two "almost there" versions I have tagged on to the end
of the validateForm function. I've tried to explain what happens
with each ... hope I've explained clearly.
VERSION 1
if(!confirm("Press OK To Proceed, Or Press Cancel To abort the submission")) {
history.go(0);
}
else {
location.href=thanks.html';
}
All works to plan if the user ok's. They then get the "you are about
to email" popup and on ok-ing that the form submits and the required
thanks.html page replaces the form. BUT if the user cancels, the
"you are about to email" popup still displays and they have to cancel
again. I wanted to avoid this and managed it in
VERSION 2 ...
if (confirm("You are about to e-mail your order. Click OK to continue. Click Cancel to abort.")) {
location.href=thanks.html';
return true; // pk
}
else {
alert("\n Your order has been cancelled.");
return false;
}
OK works fine... puts up the "you are about to email" popup and
ok-ing that submits the form and the finish.html page replaces the
form. BUT if the user cancels the submission at this ("you are about
to email" popup) stage the thanks.html page is still displayed
instead of the form remaining on screen.
With continued thanks for your patience and interest.
Yeldua