What does this code do?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nige

    What does this code do?

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

    <form action="/cgi-bin/FormMail.pl" method="POST"
    language="JavaS cript"
    onsubmit="retur n 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="JavaS cript"
    onsubmit="retur n 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
  • McKirahan

    #2
    Re: What does this code do?

    "Nige" <uYYYY@ntlworld .com> wrote in message
    news:li8euv4ovb 547nn4g7jfrelhk skrocbg1r@4ax.c om...[color=blue]
    > I've got a form which has the following code:
    >
    > <form action="/cgi-bin/FormMail.pl" method="POST"
    > language="JavaS cript"
    > onsubmit="retur n 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="JavaS cript"
    > onsubmit="retur n 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[/color]


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

    <script language="javas cript" src="Validator. js"></script>

    that contains:

    function FrontPage_Form1 _Validator(...) {
    ...
    }



    Comment

    • Nige

      #3
      Re: What does this code do?

      In comp.lang.javas cript, McKirahan wrote:
      [color=blue]
      >In the HTML source,
      > look for a JavaScript "include" file such as
      >
      > <script language="javas cript" src="Validator. js"></script>
      >
      >that contains:
      >
      > function FrontPage_Form1 _Validator(...) {
      > ...
      > }[/color]

      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

      Comment

      • McKirahan

        #4
        Re: What does this code do?

        "Nige" <uYYYY@ntlworld .com> wrote in message
        news:3eceuvklaj o8oe9v0a2qo1sqv sjbgefc36@4ax.c om...[color=blue]
        > In comp.lang.javas cript, McKirahan wrote:
        >[color=green]
        > >In the HTML source,
        > > look for a JavaScript "include" file such as
        > >
        > > <script language="javas cript" src="Validator. js"></script>
        > >
        > >that contains:
        > >
        > > function FrontPage_Form1 _Validator(...) {
        > > ...
        > > }[/color]
        >
        > 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!).[/color]

        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.




        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.


        rosoft%20FrontP age%20Unleashed ,%20by%20Willia m%20Robert%20St anek/ch20.htm


        Comment

        • Brian Genisio

          #5
          Re: What does this code do?

          Nige wrote:[color=blue]
          > I've got a form which has the following code:
          >
          > <form action="/cgi-bin/FormMail.pl" method="POST"
          > language="JavaS cript"
          > onsubmit="retur n 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="JavaS cript"
          > onsubmit="retur n 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.
          >
          >[/color]

          Here is what is likely happening...

          Somewhere in your source code that works, you have something like:
          <SCRIPT LANGUAGE="JavaS cript" 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

          Comment

          • Thomas 'PointedEars' Lahn

            #6
            Re: What does this code do?

            Nige wrote:
            [color=blue]
            > I've got a form which has the following code:
            >
            > <form action="/cgi-bin/FormMail.pl" method="POST"
            > language="JavaS cript"
            > onsubmit="retur n FrontPage_Form1 _Validator(this )"
            > name="FrontPage _Form1">
            >
            > It works, but I don't understand it.[/color]

            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.
            [color=blue]
            > If I try and use this code on another site it fails
            > (Error: Object expected),[/color]

            You have not included the above function, so you cannot call it.
            [color=blue]
            > but works with:
            >
            > <form action="/cgi-bin/FormMail.pl" method="POST"
            > language="JavaS cript"
            > onsubmit="retur n true">[/color]

            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.)
            [color=blue]
            > I think the object expected is "true",[/color]

            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.
            [color=blue]
            > 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.[/color]

            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 ;-))

            Comment

            Working...