user3250422
user3250422

Reputation: 149

Perl CGI param or Vars, can I filter the list

I need to get back a list of either field names, or a hash, but I don't want hidden fields included? Possible?

Upvotes: 0

Views: 172

Answers (2)

alex
alex

Reputation: 1304

As I understand, you need a list of the fields from the HTML form except 'hidden' form fields. You can even collect list of this fields manually your from and 'grep' them from the parameter list.

For example:

use CGI;

...    

my @hidden_fields = qw/field1 field2 field3/;
my $grep_fields = join '|', @hidden_fields;

...

my @fields = grep { !/\b($grep_fields)\b/ } $query->param();

Upvotes: 1

Quentin
Quentin

Reputation: 943833

No information about the type a field is will be sent by the browser, so there is no way to do this automatically.

You need to provide the data yourself, possibly as an array or hash in the Perl program.

Upvotes: 2

Related Questions