well the title pretty much says it all.
I'm trying to grab an html hidden form input value for use in a delphi function. I don't know delphi very well at all, so I was trying to follow the format of the other code in the program that did this successfully, but I keep getting a compile error saying either my parameters are wrong - too many or too few - or I have incompatible types. I suspect my trying to follow the same format as the rest isn't working because I'm trying to grab an integer & my examples are grabbing strings.

my code:
numFiles := formvar(fileCount, ' '); //fileCount is the name of the hidden input element - this version gives an undeclared identifier error

code already in the program that works:
descr := formvar('DESC', ' '); //DESC is the name of the textarea

8 Years
Discussion Span
Last Post by LizR

I believe I solved my problem. I had already tried putting it in quotes & then converting it to an integer:

numFiles := formvar(strToInt('fileCount'), '');

since numFiles is an integer, but that wasn't working.

so it finally occurred to me to try going the long way:

files := formvar('fileCount', ''); 
numFiles := strToInt(files);

And now it compiles! Now I'm just checking to make sure I really did get the right value.


As I said, 'fileCount' had to be a string, not a variable name. But the function (which you didnt show) was returning a string.. So yes, you would then have had to convert it to an integer.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.