Go through inputs with the same name and get all values

3

I have a web application in which I pass through input hidden a dynamic number of values through of a form for a% of Delphi%.

In action , I wanted to know a way to get all action with the same name.

When it's only a values , I use value

I'm passing the form inputs as follows:

<input type="hidden" name="numero[]" value="123" />
<input type="hidden" name="numero[]" value="456" />
<input type="hidden" name="numero[]" value="789" />

But how do I get everyone within request.ContentFields.Values['numero'] ?

  • Conventionally returns only the contents of the first action .
  • I tried to create a dynamic array and pass it to it, but it did not work.
asked by anonymous 31.03.2014 / 15:57

1 answer

1

Come on, I do not know how this is what you're doing for Delphi, so I'll use an approach we have in C #.

If you have something like this:

<input type="hidden" name="numero[0]" value="123" />
<input type="hidden" name="numero[1]" value="456" />
<input type="hidden" name="numero[2]" value="789" />

Then you would have something like this in delphi:

type
  TIntegerArray: Array of Integer;

procedure TMinhaClass.MinhaAction(numero: TIntegerArray);
var
  I: integer;
begin
  // podendo então:
  for I := 0 to High(numero) do
  begin
     // fazer o que deseja com "numero[I]".
  end;
end;

This answer is entirely based on speculation. Another point is that fields need to always have an order, without breaks, for something like:

numero[0]
numero[1]
numero[3]

Something like this would give you only the values with index 0 and 1 in your action , the field with index 3 would not receive because of the break. Confirm this too.

    
01.04.2014 / 14:44