[Lazarus] fcl-web or BrookFramework queryfields array

Michael Van Canneyt michael at freepascal.org
Fri Apr 15 21:32:18 CEST 2016



On Fri, 15 Apr 2016, Leonardo M. Ramé wrote:

>
>
> El 15/04/16 a las 16:22, Michael Van Canneyt escribió:
>> 
>> 
>> On Fri, 15 Apr 2016, Leonardo M. Ramé wrote:
>> 
>>> Hi, I need to extract the field values of a GET query of type:
>>> 
>>> http://127.0.0.1/cgi-bin/test.cgi?fields[1]=f1value&fields[2]=f2value
>>> 
>>> Is there a way to handle this apart from HttpRequest.QueryFields?
>> 
>> What other way would you like ? What is not good about this way ?
>> 
>> Michael.
>
> It works pefectly por param=value&..., but I don't know how to parse array 
> type values.
>
> example: ?filters[0]['filter']=name&filters[0]['value']=john

What is the problem ? Everything before a = is the name ?

So:

Name:=Request.QueryFields.values['filters[0][''filter'']'];
Value:=Request.QueryFields.values['filters[0][''value'']'];

It doesn't automatically convert them to arrays, obviously.
For that you need to know how the array (in this case double array) is encoded.

Microsoft uses() in it's query names, like in:

?filters(0,'filter')=name&filters(0,'value')=john

I see no need to provide routines for this.

Michael.


More information about the Lazarus mailing list