By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,636 Members | 1,190 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,636 IT Pros & Developers. It's quick & easy.

What does this code do?

P: n/a
I've got a form which has the following code:

<form action="/cgi-bin/FormMail.pl" method="POST"
language="JavaScript"
onsubmit="return FrontPage_Form1_Validator(this)"
name="FrontPage_Form1">

It works, but I don't understand it. If I try and use this code on
another site it fails (Error: Object expected), but works with:

<form action="/cgi-bin/FormMail.pl" method="POST"
language="JavaScript"
onsubmit="return true">

I think the object expected is "true", and I can see that the method in
the original code may return true or false, but I don't know where this
validation code is! Neither site has FrontPage extensions.
--
Nige

Please replace YYYY with the current year
ille quis mortem cum maximus ludos, vincat
Jul 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
"Nige" <uY***@ntlworld.com> wrote in message
news:li********************************@4ax.com...
I've got a form which has the following code:

<form action="/cgi-bin/FormMail.pl" method="POST"
language="JavaScript"
onsubmit="return FrontPage_Form1_Validator(this)"
name="FrontPage_Form1">

It works, but I don't understand it. If I try and use this code on
another site it fails (Error: Object expected), but works with:

<form action="/cgi-bin/FormMail.pl" method="POST"
language="JavaScript"
onsubmit="return true">

I think the object expected is "true", and I can see that the method in
the original code may return true or false, but I don't know where this
validation code is! Neither site has FrontPage extensions.
--
Nige

Please replace YYYY with the current year
ille quis mortem cum maximus ludos, vincat

In the HTML source,
look for a JavaScript "include" file such as

<script language="javascript" src="Validator.js"></script>

that contains:

function FrontPage_Form1_Validator(...) {
...
}

Jul 20 '05 #2

P: n/a
In comp.lang.javascript, McKirahan wrote:
In the HTML source,
look for a JavaScript "include" file such as

<script language="javascript" src="Validator.js"></script>

that contains:

function FrontPage_Form1_Validator(...) {
...
}


None found, but you led me onto the trail. There is a FrontPage web-bot
that does it; this is hidden when in FrontPage (sigh!).
--
Nige

Please replace YYYY with the current year
ille quis mortem cum maximus ludos, vincat
Jul 20 '05 #3

P: n/a
"Nige" <uY***@ntlworld.com> wrote in message
news:3e********************************@4ax.com...
In comp.lang.javascript, McKirahan wrote:
In the HTML source,
look for a JavaScript "include" file such as

<script language="javascript" src="Validator.js"></script>

that contains:

function FrontPage_Form1_Validator(...) {
...
}


None found, but you led me onto the trail. There is a FrontPage web-bot
that does it; this is hidden when in FrontPage (sigh!).


What is a WebBot?

A WebBot is a web-based robot program capable of performing certain
automatic operations. FrontPage WebBots are used by Microsoft to invoke many
of the interactive features built into FrontPage. Those features are added
to your site through the FrontPage Editor.

http://www.subspacenet.com/support/frontpage.htm
Chapter 20
Automation with FrontPage's WebBots

WebBots greatly streamline the development process and eliminate the need to
write your own scripts or add complicated HTML commands. With a WebBot you
can collect the results from forms, automatically add navigation bars,
create pages with full text searches, allow registered users to access key
areas of your Web site, and much more. There is no programming involved at
all.

http://www.emu.edu.tr/english/facili...r/bookslib/Mic
rosoft%20FrontPage%20Unleashed,%20by%20William%20R obert%20Stanek/ch20.htm
Jul 20 '05 #4

P: n/a
Nige wrote:
I've got a form which has the following code:

<form action="/cgi-bin/FormMail.pl" method="POST"
language="JavaScript"
onsubmit="return FrontPage_Form1_Validator(this)"
name="FrontPage_Form1">

It works, but I don't understand it. If I try and use this code on
another site it fails (Error: Object expected), but works with:

<form action="/cgi-bin/FormMail.pl" method="POST"
language="JavaScript"
onsubmit="return true">

I think the object expected is "true", and I can see that the method in
the original code may return true or false, but I don't know where this
validation code is! Neither site has FrontPage extensions.


Here is what is likely happening...

Somewhere in your source code that works, you have something like:
<SCRIPT LANGUAGE="JavaScript" SRC="something.js"></SCRIPT>

This means that it is loading some javascript code, likely including
FrontPage_Form1_Validator in the code.

In the version that fails, either you do not have the line, including
the javascript, or the code is not in the proper place on your server,
or both. Because of this, when you try to run the form validator, it
has never been defined, and you get a failure.

If you do not care about form input validation, you likely do not need
to worry about the function... just a guess.

Without seeing the server, it could be a different answer.
Brian

Jul 20 '05 #5

P: n/a
Nige wrote:
I've got a form which has the following code:

<form action="/cgi-bin/FormMail.pl" method="POST"
language="JavaScript"
onsubmit="return FrontPage_Form1_Validator(this)"
name="FrontPage_Form1">

It works, but I don't understand it.
Me too. It is invalid HTML (the `form' element does not
have a `language' attribute), and you have not provided
the FrontPage_Form_1_Validator(...) function.
If I try and use this code on another site it fails
(Error: Object expected),
You have not included the above function, so you cannot call it.
but works with:

<form action="/cgi-bin/FormMail.pl" method="POST"
language="JavaScript"
onsubmit="return true">
Of course. There is no function called here, only the `onsubmit'
handler is used in overkill (the event is never canceled, so the
event handler could be just left out.)

And it is still invalid HTML, the default scripting language (for
event handlers) is to be defined within the `head' element with

<meta http-equiv="Content-Script-Type" content="text/javascript">

(for JavaScript.)
I think the object expected is "true",
No. If `false' is returned, the `submit' event is canceled,
otherwise, and especially if `true' is returned, it is not.
The "object expected" is the Function object to be called
that is undefined.
and I can see that the method in the original code may return true
or false, but I don't know where this validation code is! Neither
site has FrontPage extensions.


I seriously doubt that. Nothing undefined can be called.[1]
PointedEars
___________
[1] By chance, this is quite similar to "Kiri-kin-tha's First Law of
Metaphysics": Nothing unreal exists. (Yes, we had a ST:4 re-run
here recently ;-))
Jul 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.