Add custom validation to form

K

Kevin

Hi,
I have a form that uses Front Page's validation. I would
like to add some custom validation as well.

Here's the form line that FrontPage generated:
<form name="FrontPage_Form1" method="POST" action="--
WEBBOT-SELF--"
onsubmit="location.href='_derived/nortbots.htm';return
false;" language="JavaScript" webbot-onSubmit="return
FrontPage_Form1_Validator(this)">

I created a custom function:
function customValidator(theForm) {
...my logic here...
return FrontPage_Form1_Validator(theForm);
}

Then I changed the form line to call my routine:
<form name="FrontPage_Form1" method="POST" action="--
WEBBOT-SELF--"
onsubmit="location.href='_derived/nortbots.htm';return
false;" language="JavaScript" webbot-onSubmit="return
customValidator(this)">

The FrontPage editor didn't complain that I did this.
But when I published my page to the server (which is
running FrontPage extensions), this is what was put on
the server:
<form name="FrontPage_Form1" method="POST"
action="_vti_bin/shtml.exe/signup.htm" onsubmit="return
FrontPage_Form1_Validator(this)" language="JavaScript"
webbot-action="--WEBBOT-SELF--">

FrontPage ignored my change.

Any ideas on how to add custom validation to my form
(while still using the validation that FrontPage
generated)?

Thanks,
Kevin
 
J

Jim Buyens

Howdy.

Mixing custom validation with FrontPage validation is
tough, becaues there's on one onsubmit handler and
FrontPage grabs it.

Sometimes you can sneak in by:

1. Changing the Submit button to an ordinary pushbutton.
2. Configuring the pushbutton's onclick event to
run your custom validation, and then call the form's
submit() method.

In general, though, you're best off by using 100%
FrontPage validation or 100% custom validation.

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

Similar Threads


Top