Any way to display all form fields being posted to a page?

Topics: Developer Forum
Mar 7, 2013 at 5:41 PM
I am using oRequest.form("[fieldname]") to extract the values for some form fields that are being posted to one of my pages. However, it seems that not all of the fields that I am expecting are actually being passed. So I was wondering--is there any way to display a list of ALL of the form fields that are being passed to my page? That way, I can determine if the problem is on my end, or on the end of the site that is posting the fields (a third-party payment gateway).
Coordinator
Mar 7, 2013 at 6:22 PM
As mentioned in the your thread before, you can use oRequest.oRequest.FORM(lcFormVar).item - this is not a typo: oRequest.oRequest - you state the name oRequest twice because we are subclassing the original object.

Like I said before, the Debugging variable dump example (from the Demo page) shows this:
* Note the use of oRequest.oRequest to get these variables
FOR EACH lcFormVar IN oRequest.oRequest.FORM
    lcVar =   oRequest.oRequest.FORM(lcFormVar).ITEM()
    lcSTR=lcSTR+[    <TR><TD><b> ]+ lcFormVar +[ </b></TD><TD> ] ;
        +lcVar +[</TD></TR>] 
NEXT
and the code I did a few years back to pull all the values out of the form:
FUNCTION SaveOrder
lctable=oSession.VALUE("account")
IF ISNULL(lctable)  &&9/3 CF
   oSession.Value("errormsg","Your session has timed out because of inactivity.  Please login again.")
   oResponse.Redirect(oProp.ScriptPath)
ENDIF
FOR EACH lcFormVar IN oRequest.oRequest.FORM
  lcVar =   oRequest.oRequest.FORM(lcFormVar).item
  IF lcFormVar <> [keyword] .and. lcFormVar <> [bbb]  .and. ! ISNULL(lcFormVar) .and. ! EMPTY(lcFormvar)  && the search textbox & submit value
    UPDATE &lcTable set amt_next =VAL(lcVar) WHERE cat=lcFormVar
  ENDIF  
NEXT
IF oRequest.form("hiddenName")="Save"
 order_success()
ENDIF
RETURN
ENDFUNC
Have you tried this yet?
Mar 7, 2013 at 6:39 PM
I had tried calling oRequest.dumpvars(), but that gave me an "Operator/operand type mismatch" error. However, I just tried your FOR EACH loop above, and it seems to work fine, so I'll just use it.

Thanks,

Jon