Getting the submitted form's name

Results 1 to 2 of 2

Thread: Getting the submitted form's name

  1. #1
    Kenyon Guest

    Default Getting the submitted form's name

    I have a page with several form objects on it. Every one of the form objects, when submitted, is sent to the same handler. Depending on which form was submitted, the handler performs different functions.<BR><BR>The only problem I&#039m having is, in the handler, finding out which form was submitted. Is there a way for me to get the name of the form being submitted?

  2. #2
    Join Date
    Dec 1969

    Default RE: Getting the submitted form's name

    The only way to know the name of the form is to pass it to the server yourself.<BR><BR>You might do it via a hidden field:<BR><BR>&#060;INPUT Type=Hidden Name=FormName Value="form17"&#062;<BR><BR>or you could do it by using a different name for each SUBMIT button:<BR><BR>&#060;INPUT Type=Submit Name=SUBMIT_17 Value="whatever"&#062;<BR><BR>Then, on the receiving page, you do something like this:<BR><BR>&#060;%<BR>formNumber = -1<BR>For Each Item in Request.Form<BR>&nbsp;&nbsp;&nbsp;&nbsp;If Left(Item,7) = "SUBMIT" Then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;formNumber = Mid(Item,8)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;Exit For<BR>&nbsp;&nbsp;&nbsp;&nbsp;End If<BR>Next<BR>If formNumber = -1 Then ... oops error ...<BR><BR>%&#062;<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts