Hi,
I am just starting to work with ASP, so bear that in mind...
I have an ASP page that displays records from a table, and
allows you to add, update and delete. There is a form with
one button that does adds and updates, and a second button
for deletes.
What I want to do is, instead of having the 'action' of the
form be something like:
action="updateUser.asp?mode=update"
I want to use the onClick property of Add/Update and Delete
buttons to set a value in a hidden field in the table, and NOT
have a query string, ie: action="updateUser.asp"
The problem is that I have an 'If' statement to determine if
I need to do an add/update/delete or just display the records
and form:
If (Request.Form("txtAction") = "update" Or
Request.Form("txtAction") = "delete") Then
do some stuff...
End If
The problem is that when it runs, and the page is first
displayed, I get:
Error Type:
Microsoft VBScript compilation (0x800A03EA)
Syntax error
/dms/updateUser.asp, line 49, column 43
If (Request.Form("txtAction") = "update" Or
------------------------------------------^
This makes sense if you can't include a form field in
an If statement before the form has even been defined.
So I put an If statement before it to determine that case:
If Request.Form.Count > 0 Then
Is there a better way to do this? Is there something
obviously wrong with the If statement?
tia,
Bill