I can't make an object containing the HTTP request form key-value pairs.
ActiveVFP can't fully expose the oRequest context. The only thing it does is DumpVars() which spits out a literal HTML string of a table containing the information. An HTML string is useless for practical purposes, I need a JSON string which I can then convert into an object and "for each" in my code.
I wrote a new method based on the form section of DumpVars but it doesn't produce any results.
So I tried to call out oRequest.DumpVars and it throws an error because there is not enough data-type checking.
dumpvars err#= 107 line= 1501 (in my code!) Operator/operand type mismatch.
In my code line 1501 is:
+lcVar +[]+crlf
Which assumes lcVar is a string. I would suppose it should be a string, but apparently not.
Anyway this is the method I added which produces no results (blank string):
FUNCTION formJSON
PRIVATE lcSTR, lcFormVar, lcVar
lcSTR=""
FOR EACH lcFormVar IN THIS.oRequest.FORM
IF ISBLANK(lcSTR)
lcSTR=[{]
ELSE
lcSTR=lcSTR+[,]
ENDIF
lcVar = THIS.oRequest.FORM(lcFormVar)
lcSTR=lcSTR+["]+lcFormVar+[":"]+lcVar+["]
NEXT
IF !ISBLANK(lcSTR)
lcSTR=lcSTR+[}]
ENDIF
RETURN lcSTR
ENDFUNC
And this also throws the same error on the line assuming lcVar is a string.
I tried to add data-type checking using either VARTYPE or TRANSFORM but VFP will fail to build the project if either of those commands are used at all.
Function argument value, type or count is invalid
And produces a small DLL file which is not valid.
I can't make an object containing the HTTP request form key-value pairs.
ActiveVFP can't fully expose the oRequest context. The only thing it does is DumpVars() which spits out a literal HTML string of a table containing the information. An HTML string is useless for practical purposes, I need a JSON string which I can then convert into an object and "for each" in my code.
I wrote a new method based on the form section of DumpVars but it doesn't produce any results.
So I tried to call out oRequest.DumpVars and it throws an error because there is not enough data-type checking.
dumpvars err#= 107 line= 1501 (in my code!) Operator/operand type mismatch.
In my code line 1501 is:
+lcVar +[]+crlf
Which assumes lcVar is a string. I would suppose it should be a string, but apparently not.
Anyway this is the method I added which produces no results (blank string):
FUNCTION formJSON
PRIVATE lcSTR, lcFormVar, lcVar
lcSTR=""
FOR EACH lcFormVar IN THIS.oRequest.FORM
IF ISBLANK(lcSTR)
lcSTR=[{]
ELSE
lcSTR=lcSTR+[,]
ENDIF
lcVar = THIS.oRequest.FORM(lcFormVar)
lcSTR=lcSTR+["]+lcFormVar+[":"]+lcVar+["]
NEXT
IF !ISBLANK(lcSTR)
lcSTR=lcSTR+[}]
ENDIF
RETURN lcSTR
ENDFUNC
And this also throws the same error on the line assuming lcVar is a string.
I tried to add data-type checking using either VARTYPE or TRANSFORM but VFP will fail to build the project if either of those commands are used at all.
Function argument value, type or count is invalid
And produces a small DLL file which is not valid.