null or not object problem

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

    #1

    null or not object problem

    HI all,


    This has had me confuzzeled for a while now, I've read countless threads on
    such errors and it seems to be down to the way things are set out and
    loaded. Can anyone suggest why this code throws up the null or not object
    error ? The crazy thing is it all actually works fine aswell.....


    <script language='JavaS cript'>
    function includeemail()
    {
    var f0 = document.Paypal Form0;
    f0.business.val ue = "999999"
    </script>
    </head>
    <tr>
    <TD>
    <form name='PaypalFor m0'
    action='https://www.paypal.com/cgi-bin/webscr' method='post'
    onsubmit='inclu deemail()' target='paypal' >
    <input type='image'
    src='https://www.paypal.com/en_GB/i/btn/x-click-but22.gif' border='0'
    name='submit' alt='Make payments with PayPal '>
    <input type='hidden' name='add' value='1'>
    <input type='hidden' name='cmd' value='_cart'>
    <input type='hidden' name='item_name ' value='ITEM'>
    <input type='hidden' name='amount' value='VALUE'>
    <input type='hidden' name='no_note' value='1'>
    <input type='hidden' name='currency_ code' value='GBP'>
    </form>
    </TD>
    </tr>



    ive cut out the html header stuff etc to make it easier to read..... anyone
    got anyideas ?

    thanks,
    Chris



  • Lee

    #2
    Re: null or not object problem

    exxos said:[color=blue]
    >
    >HI all,
    >
    >
    >This has had me confuzzeled for a while now, I've read countless threads on
    >such errors and it seems to be down to the way things are set out and
    >loaded. Can anyone suggest why this code throws up the null or not object
    >error ? The crazy thing is it all actually works fine aswell.....
    >
    >
    ><script language='JavaS cript'>
    >function includeemail()
    >{
    >var f0 = document.Paypal Form0;
    >f0.business.va lue = "999999"
    ></script>
    ></head>
    ><tr>
    ><TD>
    > <form name='PaypalFor m0'
    >action='http s://www.paypal.com/cgi-bin/webscr' method='post'
    >onsubmit='incl udeemail()' target='paypal' >
    > <input type='image'
    >src='https://www.paypal.com/en_GB/i/btn/x-click-but22.gif' border='0'
    >name='submit ' alt='Make payments with PayPal '>
    > <input type='hidden' name='add' value='1'>
    > <input type='hidden' name='cmd' value='_cart'>
    > <input type='hidden' name='item_name ' value='ITEM'>
    > <input type='hidden' name='amount' value='VALUE'>
    > <input type='hidden' name='no_note' value='1'>
    > <input type='hidden' name='currency_ code' value='GBP'>
    > </form>
    ></TD>
    > </tr>
    >
    >
    >
    >ive cut out the html header stuff etc to make it easier to read..... anyone
    >got anyideas ?[/color]

    You're referring to the "value" attribute of a form element named
    "business", but there is no such form element. Add another hidden
    field with that name.

    Comment

    • exxos

      #3
      Re: null or not object problem


      "Lee" <REM0VElbspamtr ap@cox.net> wrote in message
      news:cv2c090172 d@drn.newsguy.c om...[color=blue]
      > exxos said:[color=green]
      >>
      >>HI all,
      >>
      >>
      >>This has had me confuzzeled for a while now, I've read countless threads
      >>on
      >>such errors and it seems to be down to the way things are set out and
      >>loaded. Can anyone suggest why this code throws up the null or not object
      >>error ? The crazy thing is it all actually works fine aswell.....
      >>
      >>
      >><script language='JavaS cript'>
      >>function includeemail()
      >>{
      >>var f0 = document.Paypal Form0;
      >>f0.business.v alue = "999999"
      >></script>
      >></head>
      >><tr>
      >><TD>
      >> <form name='PaypalFor m0'
      >>action='https ://www.paypal.com/cgi-bin/webscr' method='post'
      >>onsubmit='inc ludeemail()' target='paypal' >
      >> <input type='image'
      >>src='https://www.paypal.com/en_GB/i/btn/x-click-but22.gif' border='0'
      >>name='submi t' alt='Make payments with PayPal '>
      >> <input type='hidden' name='add' value='1'>
      >> <input type='hidden' name='cmd' value='_cart'>
      >> <input type='hidden' name='item_name ' value='ITEM'>
      >> <input type='hidden' name='amount' value='VALUE'>
      >> <input type='hidden' name='no_note' value='1'>
      >> <input type='hidden' name='currency_ code' value='GBP'>
      >> </form>
      >></TD>
      >> </tr>
      >>
      >>
      >>
      >>ive cut out the html header stuff etc to make it easier to read.....
      >>anyone
      >>got anyideas ?[/color]
      >
      > You're referring to the "value" attribute of a form element named
      > "business", but there is no such form element. Add another hidden
      > field with that name.[/color]


      makes sence, I did that that but I took it out, it just said the same with
      it in so didn't see the use in it.... I can't set a value for it cos it will
      override the script (I think) setting it to null dont seem to work either ?!

      Chris

      [color=blue]
      >[/color]


      Comment

      • Lee

        #4
        Re: null or not object problem

        exxos said:[color=blue]
        >
        >
        >"Lee" <REM0VElbspamtr ap@cox.net> wrote in message
        >news:cv2c09017 2d@drn.newsguy. com...[color=green]
        >> exxos said:[color=darkred]
        >>>
        >>>HI all,
        >>>
        >>>
        >>>This has had me confuzzeled for a while now, I've read countless threads
        >>>on
        >>>such errors and it seems to be down to the way things are set out and
        >>>loaded. Can anyone suggest why this code throws up the null or not object
        >>>error ? The crazy thing is it all actually works fine aswell.....
        >>>
        >>>
        >>><script language='JavaS cript'>
        >>>function includeemail()
        >>>{
        >>>var f0 = document.Paypal Form0;
        >>>f0.business. value = "999999"
        >>></script>
        >>></head>
        >>><tr>
        >>><TD>
        >>> <form name='PaypalFor m0'
        >>>action='http s://www.paypal.com/cgi-bin/webscr' method='post'
        >>>onsubmit='in cludeemail()' target='paypal' >
        >>> <input type='image'
        >>>src='https ://www.paypal.com/en_GB/i/btn/x-click-but22.gif' border='0'
        >>>name='submit ' alt='Make payments with PayPal '>
        >>> <input type='hidden' name='add' value='1'>
        >>> <input type='hidden' name='cmd' value='_cart'>
        >>> <input type='hidden' name='item_name ' value='ITEM'>
        >>> <input type='hidden' name='amount' value='VALUE'>
        >>> <input type='hidden' name='no_note' value='1'>
        >>> <input type='hidden' name='currency_ code' value='GBP'>
        >>> </form>
        >>></TD>
        >>> </tr>
        >>>
        >>>
        >>>
        >>>ive cut out the html header stuff etc to make it easier to read.....
        >>>anyone
        >>>got anyideas ?[/color]
        >>
        >> You're referring to the "value" attribute of a form element named
        >> "business", but there is no such form element. Add another hidden
        >> field with that name.[/color]
        >
        >
        >makes sence, I did that that but I took it out, it just said the same with
        >it in so didn't see the use in it.... I can't set a value for it cos it will
        >override the script (I think) setting it to null dont seem to work either ?![/color]

        It would complain if you tried to set it in script before
        the form existed, but since you're calling it on submission,
        it will only complain if the field doesn't exist.

        The script doesn't run until you submit, so the script will
        override whatever value you put there. Of course, if you're
        always using the same value, you don't need the script at all.

        By the way, this doesn't contribute to your problem, but:
        <script language='JavaS cript'>
        is out-dated. You should be using:
        <script type="text/javascript">

        Comment

        • exxos

          #5
          Re: null or not object problem


          "Lee" <REM0VElbspamtr ap@cox.net> wrote in message
          news:cv2f6f01gl p@drn.newsguy.c om...[color=blue]
          > exxos said:[color=green]
          >>
          >>
          >>"Lee" <REM0VElbspamtr ap@cox.net> wrote in message
          >>news:cv2c0901 72d@drn.newsguy .com...[color=darkred]
          >>> exxos said:
          >>>>
          >>>>HI all,
          >>>>
          >>>>
          >>>>This has had me confuzzeled for a while now, I've read countless threads
          >>>>on
          >>>>such errors and it seems to be down to the way things are set out and
          >>>>loaded. Can anyone suggest why this code throws up the null or not
          >>>>object
          >>>>error ? The crazy thing is it all actually works fine aswell.....
          >>>>
          >>>>
          >>>><script language='JavaS cript'>
          >>>>function includeemail()
          >>>>{
          >>>>var f0 = document.Paypal Form0;
          >>>>f0.business .value = "999999"
          >>>></script>
          >>>></head>
          >>>><tr>
          >>>><TD>
          >>>> <form name='PaypalFor m0'
          >>>>action='htt ps://www.paypal.com/cgi-bin/webscr' method='post'
          >>>>onsubmit='i ncludeemail()' target='paypal' >
          >>>> <input type='image'
          >>>>src='http s://www.paypal.com/en_GB/i/btn/x-click-but22.gif' border='0'
          >>>>name='submi t' alt='Make payments with PayPal '>
          >>>> <input type='hidden' name='add' value='1'>
          >>>> <input type='hidden' name='cmd' value='_cart'>
          >>>> <input type='hidden' name='item_name ' value='ITEM'>
          >>>> <input type='hidden' name='amount' value='VALUE'>
          >>>> <input type='hidden' name='no_note' value='1'>
          >>>> <input type='hidden' name='currency_ code' value='GBP'>
          >>>> </form>
          >>>></TD>
          >>>> </tr>
          >>>>
          >>>>
          >>>>
          >>>>ive cut out the html header stuff etc to make it easier to read.....
          >>>>anyone
          >>>>got anyideas ?
          >>>
          >>> You're referring to the "value" attribute of a form element named
          >>> "business", but there is no such form element. Add another hidden
          >>> field with that name.[/color]
          >>
          >>
          >>makes sence, I did that that but I took it out, it just said the same with
          >>it in so didn't see the use in it.... I can't set a value for it cos it
          >>will
          >>override the script (I think) setting it to null dont seem to work either
          >>?![/color]
          >
          > It would complain if you tried to set it in script before
          > the form existed, but since you're calling it on submission,
          > it will only complain if the field doesn't exist.
          >
          > The script doesn't run until you submit, so the script will
          > override whatever value you put there. Of course, if you're
          > always using the same value, you don't need the script at all.[/color]

          I'm using the script to hide my E-mail address, its split up into a lot of
          variables, that value is then the same for each form.. but of course I dont
          want to add my full address into the form!
          [color=blue]
          >
          > By the way, this doesn't contribute to your problem, but:
          > <script language='JavaS cript'>
          > is out-dated. You should be using:
          > <script type="text/javascript">[/color]

          thanks for the update, I've only been programming in java/asp for the last
          for days, never needed any scripting or anything until recently..

          chris


          [color=blue]
          >[/color]


          Comment

          • exxos

            #6
            Re: null or not object problem


            "Lee" <REM0VElbspamtr ap@cox.net> wrote in message
            news:cv2f6f01gl p@drn.newsguy.c om...[color=blue]
            > exxos said:[color=green]
            >>
            >>
            >>"Lee" <REM0VElbspamtr ap@cox.net> wrote in message
            >>news:cv2c0901 72d@drn.newsguy .com...[color=darkred]
            >>> exxos said:
            >>>>
            >>>>HI all,
            >>>>
            >>>>
            >>>>This has had me confuzzeled for a while now, I've read countless threads
            >>>>on
            >>>>such errors and it seems to be down to the way things are set out and
            >>>>loaded. Can anyone suggest why this code throws up the null or not
            >>>>object
            >>>>error ? The crazy thing is it all actually works fine aswell.....
            >>>>
            >>>>
            >>>><script language='JavaS cript'>
            >>>>function includeemail()
            >>>>{
            >>>>var f0 = document.Paypal Form0;
            >>>>f0.business .value = "999999"
            >>>></script>
            >>>></head>
            >>>><tr>
            >>>><TD>
            >>>> <form name='PaypalFor m0'
            >>>>action='htt ps://www.paypal.com/cgi-bin/webscr' method='post'
            >>>>onsubmit='i ncludeemail()' target='paypal' >
            >>>> <input type='image'
            >>>>src='http s://www.paypal.com/en_GB/i/btn/x-click-but22.gif' border='0'
            >>>>name='submi t' alt='Make payments with PayPal '>
            >>>> <input type='hidden' name='add' value='1'>
            >>>> <input type='hidden' name='cmd' value='_cart'>
            >>>> <input type='hidden' name='item_name ' value='ITEM'>
            >>>> <input type='hidden' name='amount' value='VALUE'>
            >>>> <input type='hidden' name='no_note' value='1'>
            >>>> <input type='hidden' name='currency_ code' value='GBP'>
            >>>> </form>
            >>>></TD>
            >>>> </tr>
            >>>>
            >>>>
            >>>>
            >>>>ive cut out the html header stuff etc to make it easier to read.....
            >>>>anyone
            >>>>got anyideas ?
            >>>
            >>> You're referring to the "value" attribute of a form element named
            >>> "business", but there is no such form element. Add another hidden
            >>> field with that name.[/color]
            >>
            >>[/color][/color]


            I tried re-adding the element in the form element, but still same problem
            :-( I thought I had tried it before and it didnt work , im out of ideas!
            seems to work fine copied direct into HTML pages though which is odd :-\

            chris



            Comment

            • Lee

              #7
              Re: null or not object problem

              exxos said:
              [color=blue]
              >I tried re-adding the element in the form element, but still same problem
              >:-( I thought I had tried it before and it didnt work , im out of ideas!
              >seems to work fine copied direct into HTML pages though which is odd :-\[/color]

              Here's an example that works.
              You can tell that it works because after pressing Submit, the values of the form
              fields are added to the URL (because no ACTION is specified). The only
              significant difference between my code and yours should be the fact that I pass
              a reference to the form into the function, rather than using the full reference
              to it within the function. That eliminates the possibility that you're not
              refering to the form correctly.

              <html>
              <head>
              <script type="text/javascript">
              function includeemail(f) {
              f.business.valu e = "999999";
              }
              </script>
              </head>
              <body>
              <form name="PayPalFor m0" onsubmit="inclu deemail(this)">
              <input name="demo1" value="apple">
              <input name="business" type="hidden">
              <br>
              <input type="submit" value="Submit">
              </form>
              </body>
              </html>

              Comment

              • exxos

                #8
                Re: null or not object problem


                "Lee" <REM0VElbspamtr ap@cox.net> wrote in message
                news:cvajnk0296 5@drn.newsguy.c om...[color=blue]
                > exxos said:
                >[color=green]
                >>I tried re-adding the element in the form element, but still same problem
                >>:-( I thought I had tried it before and it didnt work , im out of
                >>ideas!
                >>seems to work fine copied direct into HTML pages though which is odd :-\[/color]
                >
                > Here's an example that works.
                > You can tell that it works because after pressing Submit, the values of
                > the form
                > fields are added to the URL (because no ACTION is specified). The only
                > significant difference between my code and yours should be the fact that I
                > pass
                > a reference to the form into the function, rather than using the full
                > reference
                > to it within the function. That eliminates the possibility that you're
                > not
                > refering to the form correctly.
                >
                > <html>
                > <head>
                > <script type="text/javascript">
                > function includeemail(f) {
                > f.business.valu e = "999999";
                > }
                > </script>
                > </head>
                > <body>
                > <form name="PayPalFor m0" onsubmit="inclu deemail(this)">
                > <input name="demo1" value="apple">
                > <input name="business" type="hidden">
                > <br>
                > <input type="submit" value="Submit">
                > </form>
                > </body>
                > </html>
                >[/color]



                I see that works, passing info to URL works in my own code also. Though ive
                been trying and either the value goes missing or I get the null object
                error......
                why have you got "this" in the includeemail(th is)" ? I have a lot of forms,
                so should I be using seperate formanames or the same one ? I also notice you
                haven't got the document line in which I had in my code, I take it thats not
                needed also ?

                all the code was supposed to do is replace my E-mail address (the 99999 bit)
                in the form value business, rather than having my full addy visable to web
                bots, maybe you can suggest a esaier way to do this ? maybe one I can
                understand! :-\

                Chris






                Comment

                Working...