Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Checkbox BUG Fix - Validation to Links

Quote Reply
Checkbox BUG Fix - Validation to Links
Hi Alex,

Ran into another checkbox problem. It has to do with validating Links.

Here's what happened. I added and changed links via add.cgi and modify.cgi which used checkboxes. In admin.cgi VALIDATE I got the listing of all the filled in checkboxes (in the validation table), then when I click on either modify or add from validate, the Links would appear in the LINKS table, but only the first checked box would be filled in.

Here's the fix. I tested it everyway I could think of (It's basically the same as discussed in a previous checkbox thread.)

In admin.cgi.

IN sub validate_records

REPLACE:
foreach $key ($in->param()) {
($in->param($key) =~ /^delete/) and push @delete_list, $key;
($in->param($key) eq "validate") and push @validate_list, $key;
($in->param($key) eq "modify") and push @modify_list, $key;
($key =~ /^(.*)-(\d+)$/) and $links{$2}{$1} = $in->param($key);
}

WITH:

# Create the list of hashes.
my %in = %{&cgi_to_hash($in)};
foreach $key (keys %in) {
($in{$key} =~ /^delete/) and push @delete_list, $key;
($in{$key} eq "validate") and push @validate_list, $key;
($in{$key} eq "modify") and push @modify_list, $key;
$key =~ /^(.+?)\-(\d+)$/ and ($links{$2}{$1} = $in{$key});
}



Peace.

Kyle
Quote Reply
Re: Checkbox BUG Fix - Validation to Links In reply to
Thanks Kyle!

Cheers,

Alex