Glad I could be of help.

Just for interest you can also submit a form from a function by "clicking"
on your submit button as in document.....yourSubmitButtonName.click();

Whats the diff you ask? When you do the document.....submit(); on the action
page the form.fieldnames dose not include the submit button name. It wasn't
clicked. The above method does include the submit button. 

And that should have been an AND not an OR between item 2 and 2a, oops.
-steve


-----Original Message-----
From: Cheryl Hill [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 08, 2002 4:17 PM
To: [EMAIL PROTECTED]
Subject: RE: [CFTALKTor] Javascript problem


Thanks a bunch Steve... that worked...

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Steve Budan
Sent: Monday, April 08, 2002 3:48 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [CFTALKTor] Javascript problem


You need to submit the form
When you click submit here is what happens
1) click submit
2) form onSubmit function executes
OR
2a) submit buttons onClick executes
3) validate function possibly cancels the submit (return false)
3a) if not cancelled the functin returns from where it was called and
continues. In other words the form is now submitted.

The <a href=.... calls the validate function but it does not submit the
form,it just returns to the <a href=... and the link is loaded, but the form
is not submitted

Beware of double submitting the form!!!!

I would remove the submit button, and the forms onSubmit function (if it has
one)

I would use just a button with an onClick="validate(this);"

if the form fails validation, alert user, do nothing (reutrn false) should
prevent the user from proceeding from the <a href=....

if the form passes validation submit the form document.....submit() or
document...submit; I can't recall the exact syntax

-steve



<A HREF="#"
> onclick="document.MyFormName.GOTOPAGE.value =
> 'pagethree';return validateform(this);">Page 1</A>

Steve Budan
Cold Fusion Developer
Baxter Corporation
AUTROS POINT OF CARE System
One Yorkdale Road, Suite 310
Toronto, ON M6A 3A1
(416) 784-1100 ext. 182


-----Original Message-----
From: Cheryl Hill [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 08, 2002 3:32 PM
To: [EMAIL PROTECTED]
Subject: RE: [CFTALKTor] Javascript problem


The case sensitivity thing was not an issue ... the actual fieldname was OK.

The validation is working BUT, the document is just not submitting.

here's the validation script...

function validateform(form)
{
        var submitform = true;
        var manfields = "The Following fields are Mandatory:\n\n";
        var form = document.MyFormName;
        if (form.TXTACTIVITIES.value == '')
                {
                submitform = false;
                manfields += "Extracurricular activities description\n";
                }
        if (form.TXTESSAY.value == '')
                {
                submitform = false;
                manfields += "Personal Statement\n";
                }
        if(submitform == false)
                {
                alert(manfields);
                return false;
                }
}

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Marc Campeau
Sent: Monday, April 08, 2002 3:21 PM
To: [EMAIL PROTECTED]
Subject: RE: [CFTALKTor] Javascript problem


This looks like a case sensitivity thing. Remember that JavaScript is case
sensitive so variable TOTO != toto. In the posted code you have GoToPage and
GOTOPAGE...

Sometimes "return foo(bar);" doesn't work well in onClick, don't know why?
try "if ( foo(bar) ) { return true; } else { return false; }... that might
be it otherwise post the validation function.

Marc

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Cheryl Hill
> Sent: Monday, April 08, 2002 3:09 PM
> To: [EMAIL PROTECTED]
> Subject: [CFTALKTor] Javascript problem
>
>
> I have an app with multiple form pages.  The user has a number of ways of
> moving through the pages.
>
> 1.  Each form has a submit button.  When it is clicked, the form does
> validation then passes them on to the action page, which
> autoredirects them
> to the next page.  No problem ... works great.
>
> 2.  There is a "toolbar" at the top of the page with each a link to each
> page (except the one they are on).
>
> Here's the rub... if the user is on page 1 and clicks on page 3,
> the system
> is supposed to first validate page 1, then pass them on to page 3.
>
> I've created a form element called "GoToPage" on the form.  What I need to
> do when the user clicks a LINK from the toolbar is
>
> a) update the value of the GoToPage element
> b) submit the form, first calling the validation script.
>
> On my action page, I am checking the value of the GoToPage field.  If it
> isn't zero, it redirects them to whatever page is in the formfield.
>
> My problem?  I'm not doing this right.
>
> Here is the link...<A HREF="#"
> onclick="document.MyFormName.GOTOPAGE.value =
> 'pagethree';return validateform(this);">Page 1</A>
>
> The form isn't being submitted.
>
> Thanks,
>
> Cheryl
>
> -
> You are subscribed to the CFUGToronto CFTALK ListSRV.
> This message has been posted by: "Cheryl Hill" <[EMAIL PROTECTED]>
> To Unsubscribe, Please Visit and Login to http://www.CFUGToronto.org/
> Manager: Kevin Towes ([EMAIL PROTECTED])
http://www.CFUGToronto.org/
This System has been donated by Infopreneur, Inc.
(http://www.infopreneur.net)

-
You are subscribed to the CFUGToronto CFTALK ListSRV.
This message has been posted by: "Marc Campeau" <[EMAIL PROTECTED]>
To Unsubscribe, Please Visit and Login to http://www.CFUGToronto.org/
Manager: Kevin Towes ([EMAIL PROTECTED]) http://www.CFUGToronto.org/
This System has been donated by Infopreneur, Inc.
(http://www.infopreneur.net)

-
You are subscribed to the CFUGToronto CFTALK ListSRV.
This message has been posted by: "Cheryl Hill" <[EMAIL PROTECTED]>
To Unsubscribe, Please Visit and Login to http://www.CFUGToronto.org/
Manager: Kevin Towes ([EMAIL PROTECTED]) http://www.CFUGToronto.org/
This System has been donated by Infopreneur, Inc.
(http://www.infopreneur.net)
-
You are subscribed to the CFUGToronto CFTALK ListSRV.
This message has been posted by: Steve Budan <[EMAIL PROTECTED]>
To Unsubscribe, Please Visit and Login to http://www.CFUGToronto.org/
Manager: Kevin Towes ([EMAIL PROTECTED]) http://www.CFUGToronto.org/
This System has been donated by Infopreneur, Inc.
(http://www.infopreneur.net)

-
You are subscribed to the CFUGToronto CFTALK ListSRV.
This message has been posted by: "Cheryl Hill" <[EMAIL PROTECTED]>
To Unsubscribe, Please Visit and Login to http://www.CFUGToronto.org/
Manager: Kevin Towes ([EMAIL PROTECTED]) http://www.CFUGToronto.org/
This System has been donated by Infopreneur, Inc.
(http://www.infopreneur.net)
-
You are subscribed to the CFUGToronto CFTALK ListSRV.
This message has been posted by: Steve Budan <[EMAIL PROTECTED]>
To Unsubscribe, Please Visit and Login to http://www.CFUGToronto.org/
Manager: Kevin Towes ([EMAIL PROTECTED]) http://www.CFUGToronto.org/
This System has been donated by Infopreneur, Inc.
(http://www.infopreneur.net)

Reply via email to