Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Passing search term to modify_multi_search_results

Quote Reply
Passing search term to modify_multi_search_results
How do I set up a link with predefined search options and have the results displayed by modify_multi_search_results?

In other words, I want to send a predefined query to the table editor on the admin side of course.
Currently I am cycling thru the results returned from a $table->select, and displaying the results manually using html.
Code:
my $links_db = $DB->table('Links') || return $GT::SQL::error;
my $prefix_plus_table = $DB->prefix . "Links";
$links_db->select_options('ORDER BY Title ASC') || return $GT::SQL::error;
my $sth = $links_db->select({ MyValue => '0' });

print q|<table><tr><td>Title</td><td>Value</td></tr>|;

while (my $link = $sth->fetchrow_hashref)
{
print q|<tr><td>|;
print $link->{'Title'};
print q|</td><td>|;

if($link->{'MyValue'} == '0') { print "Invalid"; }

print q|</td></tr>|;
}
print q|</table><BR>|;

I want to pass the results to modify_multi_search_results. This is my non-working attempt. It doesn't display correct results,
but does display them on the modify_multi_search_results page. :-)
Code:
print qq|<a href="$CFG->{admin_root_url}/admin.cgi?do=modify_multi_search_results&db=Links&MyValue=0">Show Results</a><br>|;

And then how do I pass the option to "Display Records" "As Rows"?

Thanks,
Chris
RGB World, Inc. - Software &amp; Web Development.
rgbworld.com
Quote Reply
Re: [rgbworld] Passing search term to modify_multi_search_results In reply to
Here I go answering my own question again Wink

The hyperlink code above was correct in that it was displaying results on the modify_multi_search_results form.
The results were wrong though when I manually checked them.

The problem was that I was searching for a value of 0, and I needed to use "EXACTLY" equal to for the query.
Adding -opt=%3D as filtering options? fixed the erronious results I was recieving.

So, this code creates a hyperlink that querys the Links table and displays the results on the multi results form.
Code:
print qq|<a href="$CFG->{admin_root_url}/admin.cgi?do=modify_multi_search_results&db=Links&query=&MyValue=0&MyValue-opt=%3D&MyValue2=0&MyValue2-opt=%3D">Show Invalid</a><br>|;

The url produced looks like:
admin/admin.cgi?do=modify_multi_search_results&db=Links&query=&MyValue=0&MyValue-opt==&MyValue2=0&MyValue2-opt==

How do I supply the option to "Display Records" "As Rows"?

Chris
RGB World, Inc. - Software &amp; Web Development.
rgbworld.com