Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Finding if a certain form elements exists...

Reply
Thread Tools

Finding if a certain form elements exists...

 
 
Stu
Guest
Posts: n/a
 
      08-18-2003
Hi,

I want to be able to check if a form element exists in the form post data.
IN this instance I want to find out if Request.Form("Postcode") is part of
the forms collection.

I have tried:

If Request.Form("Address Line 5").Length > 0 Then Response.Write("It
exists!")

but get the error:
Object reference not set to an instance of an object.

Thanks in advance,

Stu



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.510 / Virus Database: 307 - Release Date: 14/08/2003


 
Reply With Quote
 
 
 
 
Marina
Guest
Posts: n/a
 
      08-18-2003
The problem here is, that it doesn't exist - but you are trying to get the
Length property of an object that doesn't exist

Try: If Request.Form("Address Line 5") <> "" Then

OR

If Not IsNothing(Request.Form("Address Line 5") ) Then

"Stu" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> I want to be able to check if a form element exists in the form post data.
> IN this instance I want to find out if Request.Form("Postcode") is part of
> the forms collection.
>
> I have tried:
>
> If Request.Form("Address Line 5").Length > 0 Then Response.Write("It
> exists!")
>
> but get the error:
> Object reference not set to an instance of an object.
>
> Thanks in advance,
>
> Stu
>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.510 / Virus Database: 307 - Release Date: 14/08/2003
>
>



 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      08-18-2003
Your problem could be in naming form fields with spaces in the names.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Neither a follower nor a lender be.

"Stu" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> I want to be able to check if a form element exists in the form post data.
> IN this instance I want to find out if Request.Form("Postcode") is part of
> the forms collection.
>
> I have tried:
>
> If Request.Form("Address Line 5").Length > 0 Then Response.Write("It
> exists!")
>
> but get the error:
> Object reference not set to an instance of an object.
>
> Thanks in advance,
>
> Stu
>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.510 / Virus Database: 307 - Release Date: 14/08/2003
>
>



 
Reply With Quote
 
Stu
Guest
Posts: n/a
 
      08-19-2003
Many thanks.

The 'If Not IsNothing(Request.Form("Address Line 5") ) Then' worked great.

Kevin > I had tried both with and without the spaces in the form name and
the spaces don't alter the functionality. I know spaces in form names is not
good practice, but the form is built by an end user using a WYSIWYG edtor
and could be called anything...I'm almost surprised that they stopped at
spaces



"Kevin Spencer" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Your problem could be in naming form fields with spaces in the names.
>
> --
> HTH,
>
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> http://www.takempis.com
> Neither a follower nor a lender be.
>
> "Stu" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi,
> >
> > I want to be able to check if a form element exists in the form post

data.
> > IN this instance I want to find out if Request.Form("Postcode") is part

of
> > the forms collection.
> >
> > I have tried:
> >
> > If Request.Form("Address Line 5").Length > 0 Then Response.Write("It
> > exists!")
> >
> > but get the error:
> > Object reference not set to an instance of an object.
> >
> > Thanks in advance,
> >
> > Stu
> >
> >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.510 / Virus Database: 307 - Release Date: 14/08/2003
> >
> >

>
>



 
Reply With Quote
 
Kevin Spencer
Guest
Posts: n/a
 
      08-19-2003
Make sure it works in all browsers, unless you're developing specifically
for IE. Chances are, it won't.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Neither a follower nor a lender be.

"Stu" <(E-Mail Removed)> wrote in message
news:eR%(E-Mail Removed)...
> Many thanks.
>
> The 'If Not IsNothing(Request.Form("Address Line 5") ) Then' worked great.
>
> Kevin > I had tried both with and without the spaces in the form name and
> the spaces don't alter the functionality. I know spaces in form names is

not
> good practice, but the form is built by an end user using a WYSIWYG edtor
> and could be called anything...I'm almost surprised that they stopped at
> spaces
>
>
>
> "Kevin Spencer" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Your problem could be in naming form fields with spaces in the names.
> >
> > --
> > HTH,
> >
> > Kevin Spencer
> > Microsoft MVP
> > .Net Developer
> > http://www.takempis.com
> > Neither a follower nor a lender be.
> >
> > "Stu" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Hi,
> > >
> > > I want to be able to check if a form element exists in the form post

> data.
> > > IN this instance I want to find out if Request.Form("Postcode") is

part
> of
> > > the forms collection.
> > >
> > > I have tried:
> > >
> > > If Request.Form("Address Line 5").Length > 0 Then Response.Write("It
> > > exists!")
> > >
> > > but get the error:
> > > Object reference not set to an instance of an object.
> > >
> > > Thanks in advance,
> > >
> > > Stu
> > >
> > >
> > >
> > > ---
> > > Outgoing mail is certified Virus Free.
> > > Checked by AVG anti-virus system (http://www.grisoft.com).
> > > Version: 6.0.510 / Virus Database: 307 - Release Date: 14/08/2003
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows Vista cannot obtain an IP address from certain routers or from certain non-Microsoft DHCP Brian W Wireless Networking 7 01-31-2010 03:46 AM
Binding certain rows to certain columns in GridView? bernard.oflynn@gmail.com ASP .Net 2 03-25-2008 03:49 PM
Finding one certain line in a file is easy but how to look forheadlines and something just under this certain headline? kazaam Ruby 3 08-26-2007 03:34 PM
Expanding certain path to certain node in a JTree arun.hallan@gmail.com Java 0 01-08-2005 08:26 PM
field validation as float with certain integer and certain decimal SAN CAZIANO Javascript 8 10-15-2004 05:24 PM



Advertisments