How to make Javascript validation function to work with FP form

P

Peter Afonin

Hello:

I want to use a JavaScript function that validates the e-mail address in FP
form. This works great with any non-FP form. In Fronpage, however, I have
these problems:

If I use it like with the regular form: onsubmit="return
emailCheck(this.Email.value)" - it doesn't work;

If I use it like this: webbot-onSubmit="return
emailCheck(this.email.value);return FrontPage_Form1_Validator(this)" - it
works, but any other validation doesn't.

If I change the order like this: webbot-onSubmit="return
FrontPage_Form1_Validator(this); return emailCheck(this.email.value)" - all
other validations works, but my function doesn't.

How to use this JS function so both would work - the FP validation and JS
function?

I would appreciate your help.

Thank you,
 
T

Thomas A. Rowe

You have to apply your FP validation, then do a view source in IE, then copy
the script to notepad, add you modification, then open the form back in FP
and remove all of the form field validations, then paste you modified script
before the opening form tag and change the form name to something other than
"FrontPage_Form1"

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
 
P

Peter Afonin

Thank you, I'll try this.

Peter

Thomas A. Rowe said:
You have to apply your FP validation, then do a view source in IE, then copy
the script to notepad, add you modification, then open the form back in FP
and remove all of the form field validations, then paste you modified script
before the opening form tag and change the form name to something other than
"FrontPage_Form1"

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================
 
J

Jim Buyens

-----Original Message-----
Hello:
Howdy.

I want to use a JavaScript function that validates the
e-mail address in FP form. This works great with any
non-FP form. In Fronpage, however, I have these problems:

If I use it like with the regular form: onsubmit="return
emailCheck(this.Email.value)" - it doesn't work;

If I use it like this: webbot-onSubmit="return
emailCheck(this.email.value);return
FrontPage_Form1_Validator(this)" - it
works, but any other validation doesn't.

If I change the order like this: webbot-onSubmit="return
FrontPage_Form1_Validator(this); return emailCheck
(this.email.value)" - all other validations works, but
my function doesn't.

How to use this JS function so both would work - the FP
validation and JS function?

In general, it's best to use FrontPage form field
validation exclusively, or custom form field validation
exclusively.

In some cases, you may have success changing the Submit
button into an ordinary pushbutton like this:

<input type="button" value="Submit" name="btnSub"
onclick="emailCheck(this.email.value);">

and then coding the emailCheck function to call
document.forms[0].submit() if the email address is OK.

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 
P

Peter Afonin

Thank you!

It worked, although I modified it a little. I left a button type "submit"
(otherwise I would have to figure out how to submit the form using a
different methods).

Now my Form line looks like this:

<form method="POST" name="FrontPage_Form1" action="--WEBBOT-SELF--"
onsubmit="return FrontPage_Form1_Validator(this)" language="JavaScript">

And the button looks like this:

<input type="submit" onclick="return
emailCheck(document.forms[0].Email.value)" value="Send" name="Submit"
style="font-family: Tahoma; font-size: 8pt; font-weight: bold">

Now both validations work. The only small imperfection is that the email
address gets validated first. I tried to change the places, but this didn't
work.

Peter

Jim Buyens said:
-----Original Message-----
Hello:
Howdy.

I want to use a JavaScript function that validates the
e-mail address in FP form. This works great with any
non-FP form. In Fronpage, however, I have these problems:

If I use it like with the regular form: onsubmit="return
emailCheck(this.Email.value)" - it doesn't work;

If I use it like this: webbot-onSubmit="return
emailCheck(this.email.value);return
FrontPage_Form1_Validator(this)" - it
works, but any other validation doesn't.

If I change the order like this: webbot-onSubmit="return
FrontPage_Form1_Validator(this); return emailCheck
(this.email.value)" - all other validations works, but
my function doesn't.

How to use this JS function so both would work - the FP
validation and JS function?

In general, it's best to use FrontPage form field
validation exclusively, or custom form field validation
exclusively.

In some cases, you may have success changing the Submit
button into an ordinary pushbutton like this:

<input type="button" value="Submit" name="btnSub"
onclick="emailCheck(this.email.value);">

and then coding the emailCheck function to call
document.forms[0].submit() if the email address is OK.

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 
J

Jon Spivey

The only drawback with this is the email validation won't fire if the user
hits Enter to submit the form. As a longer term solution you might want to
spend some time learning how to write your own validation scripts - start by
studying the script FP writes and you'll see it's very simple to do.

--
Cheers,
Jon
Microsoft MVP - FP

Peter Afonin said:
Thank you!

It worked, although I modified it a little. I left a button type "submit"
(otherwise I would have to figure out how to submit the form using a
different methods).

Now my Form line looks like this:

<form method="POST" name="FrontPage_Form1" action="--WEBBOT-SELF--"
onsubmit="return FrontPage_Form1_Validator(this)" language="JavaScript">

And the button looks like this:

<input type="submit" onclick="return
emailCheck(document.forms[0].Email.value)" value="Send" name="Submit"
style="font-family: Tahoma; font-size: 8pt; font-weight: bold">

Now both validations work. The only small imperfection is that the email
address gets validated first. I tried to change the places, but this didn't
work.

Peter

Jim Buyens said:
-----Original Message-----
Hello:
Howdy.

I want to use a JavaScript function that validates the
e-mail address in FP form. This works great with any
non-FP form. In Fronpage, however, I have these problems:

If I use it like with the regular form: onsubmit="return
emailCheck(this.Email.value)" - it doesn't work;

If I use it like this: webbot-onSubmit="return
emailCheck(this.email.value);return
FrontPage_Form1_Validator(this)" - it
works, but any other validation doesn't.

If I change the order like this: webbot-onSubmit="return
FrontPage_Form1_Validator(this); return emailCheck
(this.email.value)" - all other validations works, but
my function doesn't.

How to use this JS function so both would work - the FP
validation and JS function?

In general, it's best to use FrontPage form field
validation exclusively, or custom form field validation
exclusively.

In some cases, you may have success changing the Submit
button into an ordinary pushbutton like this:

<input type="button" value="Submit" name="btnSub"
onclick="emailCheck(this.email.value);">

and then coding the emailCheck function to call
document.forms[0].submit() if the email address is OK.

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 

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