HARD one: Determine if form variable present on the submitting pag

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've got a several different SubmitterForm.htm that submits to a
Processer.ASP.

Some of them may have the EMail2 text box field. If they do, I want to make
sure that Email1=Email2 (i.e., they retyped thier email address correctly).

I know I could probably parse thru all the fields by index and see if any of
the names match "Email2", but I was hoping for somethign simpler like:

If "Email2" is in collection-of-form-variables, etc.

Any ideas?
 
Include a hidden form field that indicates the form has this extra field, such as:

<input type="hidden" name="Email2YN" value="1">

Then on Processer.asp

If Request.Form("Email2YN") = 1 Then
Insert Your testing code here
End If

Note if they fail your test and you use Response.Redirect by to the Form page, they will have to
retype all info again. You will need to use a JavaScript function that checks before they leave the
form page.
--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================
 
Or better still to make sure each form only processes the fields in that form (to prevent errors of missing fields).
In each form add a form identifier hidden field (where X is unique for each form) as say":

<input type="hidden" name="FormType" value="FormNameX">

Then in your process page check for it with

Select Case Request.Form("FormType")
Case "FormName1"
' handle unique FormName1 fields
Case "FormName2"
' handle unique FormName2 fields
Case "FormName3"
' handle unique FormName3 fields
Case Else
' handle if not from one of the named forms
End Select
' handle common form fields

--




| Include a hidden form field that indicates the form has this extra field, such as:
|
| <input type="hidden" name="Email2YN" value="1">
|
| Then on Processer.asp
|
| If Request.Form("Email2YN") = 1 Then
| Insert Your testing code here
| End If
|
| Note if they fail your test and you use Response.Redirect by to the Form page, they will have to
| retype all info again. You will need to use a JavaScript function that checks before they leave the
| form page.
| --
| ==============================================
| Thomas A. Rowe (Microsoft MVP - FrontPage)
| ==============================================
| If you feel your current issue is a results of installing
| a Service Pack or security update, please contact
| Microsoft Product Support Services:
| http://support.microsoft.com
| If the problem can be shown to have been caused by a
| security update, then there is usually no charge for the call.
| ==============================================
|
| | >
| > I've got a several different SubmitterForm.htm that submits to a
| > Processer.ASP.
| >
| > Some of them may have the EMail2 text box field. If they do, I want to make
| > sure that Email1=Email2 (i.e., they retyped thier email address correctly).
| >
| > I know I could probably parse thru all the fields by index and see if any of
| > the names match "Email2", but I was hoping for somethign simpler like:
| >
| > If "Email2" is in collection-of-form-variables, etc.
| >
| > Any ideas?
| >
| >
|
|
 
Why not just check if the field called email2 exists and if so compare it
with email1
<%
for i = 1 to request.form.count
if request.form.keys(i) = "email2" then
if request.form("email1") <> request.form("email2") then
' emails don't match do the error
end if
exit for
end if
next
%>
 
Back
Top