473,246 Members | 1,932 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,246 software developers and data experts.

determine if a form object exists

JT
is there a way to determine if a form object actually exists?

if i use the following syntax:

varTextField = Request.Form("txtFormField")

then varTextField = "" which gives the same result whether the input field
"txtFormField" doesn't exist or it does exist but it was left empty

why can't i use something like?

if Exists(Request.Form("txtFormField")) = true then
'whatever..
Jul 19 '05 #1
7 12811
Function formFieldExists(fieldName)
formFieldExists = (InStr(Request.Form, fieldname & "=") > 0)
End Function
Response.Write(formFieldExists("txtFormField"))

Now, this will work as long as someone doesn't pass "txtFormField=" in the
DATA for a form field with a different name.

--
http://www.aspfaq.com/
(Reverse address to reply.)


"JT" <jt@nospam.com> wrote in message
news:Oc**************@TK2MSFTNGP09.phx.gbl...
is there a way to determine if a form object actually exists?

if i use the following syntax:

varTextField = Request.Form("txtFormField")

then varTextField = "" which gives the same result whether the input field
"txtFormField" doesn't exist or it does exist but it was left empty

why can't i use something like?

if Exists(Request.Form("txtFormField")) = true then
'whatever..

Jul 19 '05 #2
JT wrote:
is there a way to determine if a form object actually exists?
Yes. The form object never exists.

There is a .Form collection of the Request Object, and it contains .Item and
..Count elements for each *named* form element in the POSTing form.
http://msdn.microsoft.com/library/en...bom_reqocf.asp
if i use the following syntax:

varTextField = Request.Form("txtFormField")

then varTextField = "" which gives the same result whether the input
field "txtFormField" doesn't exist or it does exist but it was left
empty


On the other hand, you can examine

Request.Form("txtFormField").Count

to get the information you desire.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #3
> On the other hand, you can examine

Request.Form("txtFormField").Count

to get the information you desire.


Of course! <smacks forehead for building a kludge>
Jul 19 '05 #4
Aaron [SQL Server MVP] wrote:

Of course! <smacks forehead for building a kludge>


Must be quitting time, Aaron. Go buy yourself a beer. In fact, I'll buy
myself one in your honor on the way home (I'll accept any excuse to buy
myself a beer).

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #5
> (I'll accept any excuse to buy myself a beer).

In that case, get yourself a beer for me too

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"Dave Anderson" <GT**********@spammotel.com> wrote in message
news:OT**************@TK2MSFTNGP10.phx.gbl...
Aaron [SQL Server MVP] wrote:

Of course! <smacks forehead for building a kludge>
Must be quitting time, Aaron. Go buy yourself a beer. In fact, I'll buy
myself one in your honor on the way home (I'll accept any excuse to buy
myself a beer).

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message.

Use of this email address implies consent to these terms. Please do not contact me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.

Jul 19 '05 #6
Steven Burn wrote:
(I'll accept any excuse to buy myself a beer).


In that case, get yourself a beer for me too


But judging from your .sig, I think it would be appropriate to hold off
until I'm in the U.K. in two weeks. Then I'll be able to enjoy a good
cask-conditioned ale like Courage Director's Bitter**.

**My eyes glazed over and I made dreamy "Mmmmm" noises to the distraction of
my office mates as I typed that.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #7
Use IsEmpty(Request.Form("txtFormField"))
-----Original Message-----
is there a way to determine if a form object actually exists?
if i use the following syntax:

varTextField = Request.Form("txtFormField")

then varTextField = "" which gives the same result whether the input field"txtFormField" doesn't exist or it does exist but it was left empty
why can't i use something like?

if Exists(Request.Form("txtFormField")) = true then
'whatever..
.

Jul 19 '05 #8

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

Similar topics

18
by: Christopher W. Douglas | last post by:
I am writing a VB.NET application in Visual Studio 2003. I have written a method that handles several events, such as closing a form and changing the visible status of a form. I have some code...
3
by: Web Webon | last post by:
Hi everybody! I wonder if this is possible? I need to determine if a client is using "windows classic folders" or anything else. If I instantiate a Shell ActiveX object is there a way of...
1
by: kyma via .NET 247 | last post by:
Hi, I haveto use VB to create a form that reads an exisiting XML fileand then allows updates via the VB form. My problem is that I was able to get VB to read a simple XML file(people.XML), but...
4
by: MLH | last post by:
From FormA or from the immediate window, what can I run to determine if a specified control (say, "MyComboBox") exists on FormB (or ReportB)? We could narrow it down, specifying that FormB (or...
9
by: Adam | last post by:
Can someone please help!! I am trying to figure out what a font is? Assume I am working with a fixed font say Courier 10 point font Question 1: What does this mean 10 point font Question 2:...
3
by: Bob Day | last post by:
VS 2003, sql How do you determine the data type of a column if its value is DBNull? 1)Table: Column1 STRING non-nullable 2) Fill to a DataSet via DataAdapter 3) dim Data_Type_Is...
8
by: Darrell Wesley | last post by:
Is there any better method of determining if a file exists then using the Scripting.FileSystemObject If I do thi Dim fs As New System.IO.StreamReader(FileName and the file does not exist...
2
by: jmhmaine | last post by:
I've created a lookup class for a windows form application and I'm stuck on how on using the collection object. The process is simple, if the item is in the collection then return that object, if...
13
by: softwaredoug | last post by:
I can't see to easily find this on google or in a newsgroup Is there a standard function/macro/whatever you can call and determine the distance in a C program how deep one is in the C call stack...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.