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

Recommended Answers

All 3 Replies

fileCount should be in single quotes. Its a string.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.