473,395 Members | 1,948 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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='JavaScript'>
function includeemail()
{
var f0 = document.PaypalForm0;
f0.business.value = "999999"
</script>
</head>
<tr>
<TD>
<form name='PaypalForm0'
action='https://www.paypal.com/cgi-bin/webscr' method='post'
onsubmit='includeemail()' 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

Jul 23 '05 #1
7 1461
Lee
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='JavaScript'>
function includeemail()
{
var f0 = document.PaypalForm0;
f0.business.value = "999999"
</script>
</head>
<tr>
<TD>
<form name='PaypalForm0'
action='https://www.paypal.com/cgi-bin/webscr' method='post'
onsubmit='includeemail()' 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 ?


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.

Jul 23 '05 #2

"Lee" <RE**************@cox.net> wrote in message
news:cv*********@drn.newsguy.com...
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='JavaScript'>
function includeemail()
{
var f0 = document.PaypalForm0;
f0.business.value = "999999"
</script>
</head>
<tr>
<TD>
<form name='PaypalForm0'
action='https://www.paypal.com/cgi-bin/webscr' method='post'
onsubmit='includeemail()' 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 ?
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.

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


Jul 23 '05 #3
Lee
exxos said:


"Lee" <RE**************@cox.net> wrote in message
news:cv*********@drn.newsguy.com...
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='JavaScript'>
function includeemail()
{
var f0 = document.PaypalForm0;
f0.business.value = "999999"
</script>
</head>
<tr>
<TD>
<form name='PaypalForm0'
action='https://www.paypal.com/cgi-bin/webscr' method='post'
onsubmit='includeemail()' 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 ?


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.

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 ?!


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='JavaScript'>
is out-dated. You should be using:
<script type="text/javascript">

Jul 23 '05 #4

"Lee" <RE**************@cox.net> wrote in message
news:cv*********@drn.newsguy.com...
exxos said:


"Lee" <RE**************@cox.net> wrote in message
news:cv*********@drn.newsguy.com...
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='JavaScript'>
function includeemail()
{
var f0 = document.PaypalForm0;
f0.business.value = "999999"
</script>
</head>
<tr>
<TD>
<form name='PaypalForm0'
action='https://www.paypal.com/cgi-bin/webscr' method='post'
onsubmit='includeemail()' 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 ?

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.

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
?!


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.


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!

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

Jul 23 '05 #5

"Lee" <RE**************@cox.net> wrote in message
news:cv*********@drn.newsguy.com...
exxos said:


"Lee" <RE**************@cox.net> wrote in message
news:cv*********@drn.newsguy.com...
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='JavaScript'>
function includeemail()
{
var f0 = document.PaypalForm0;
f0.business.value = "999999"
</script>
</head>
<tr>
<TD>
<form name='PaypalForm0'
action='https://www.paypal.com/cgi-bin/webscr' method='post'
onsubmit='includeemail()' 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 ?

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.


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

Jul 23 '05 #6
Lee
exxos said:
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 :-\


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.value = "999999";
}
</script>
</head>
<body>
<form name="PayPalForm0" onsubmit="includeemail(this)">
<input name="demo1" value="apple">
<input name="business" type="hidden">
<br>
<input type="submit" value="Submit">
</form>
</body>
</html>

Jul 23 '05 #7

"Lee" <RE**************@cox.net> wrote in message
news:cv*********@drn.newsguy.com...
exxos said:
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 :-\


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.value = "999999";
}
</script>
</head>
<body>
<form name="PayPalForm0" onsubmit="includeemail(this)">
<input name="demo1" value="apple">
<input name="business" type="hidden">
<br>
<input type="submit" value="Submit">
</form>
</body>
</html>


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(this)" ? 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


Jul 23 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: James Fisher | last post by:
How are people handling NULL values for value types. Descriptions of problem Say you have a typical method with the signature: public int InsertPerson(string firstName, string lastName, int...
5
by: David Sworder | last post by:
Hi, I've created a UserControl-derived class called MyUserControl that is able to persist and subsequently reload its state. It exposes two methods as follows: public void Serialize(Stream...
9
by: Steve Sargent | last post by:
Hi: I'm trying to debug the following code, and it keeps looping on the if statement: public static bool operator == (OnlineMemberNode first, OnlineMemberNode second) { if(first == null) {
5
by: Boniek | last post by:
Hi I define a public property in a new form and I can see this property in table of Properties in Visual. How I can hide this property to see only in code ? Thank's Boniek
2
by: Jongmin | last post by:
Hi, I have made two classes, which are simple and almost same, T_A and T_B. T_A has a static method overloaded to "==". T_B dosn't. And, I run the following code. I expect both "a" and "b"...
10
by: Wilhelm Heramb | last post by:
What is the best practice to implement operator overloading for == and != that handles null on either lhs or rhs. Andreas :-)
7
by: Danny Tuppeny | last post by:
Hi All, I've been going through Google Groups, but nothing seems to quite match my problem. It's hard to post a WSDL or anything at the moment (it's not my service, I'm just using it), but maybe...
3
by: Jon L | last post by:
Hi, I'm hoping someone can help me with this problem. I'm not sure whether the problem lies with the software or with my understanding of the language. I'm using the Microsoft.XMLDOM object...
1
by: connor7777 | last post by:
Hi guys: We've been weeding out errors off of a java->c# project and have managed to redeem most of our code with the exception of one bug that we for some reason cannot pin down. The following...
11
by: MikeT | last post by:
This may sound very elementary, but can you trap when your object is set to null within the object? I have created a class that registers an event from an object passed in the constructor. When...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.