[fusion-users] Fusion Search widget - Error when using Filter

kelll kellieharrisson at sierrasystems.com
Wed Nov 10 14:45:14 EST 2010


Hi there, 

I am trying to implement the fusion search widget. Im using fusion version
2.0.0 with Mapguide OS 2.1. 
My mapguide is within an iFrame. 

Here is my search widget settings in ApplicationDefinition.xml: 

<Widget xsi:type="UiWidgetType"> 
  <Name>toolbarSearch</Name> 
  <Type>Search</Type> 
  <StatusText>Search.</StatusText> 
  <ImageUrl>images/icons/search.png</ImageUrl> 
  <ImageClass/> 
  <Tooltip>Search</Tooltip> 
  <Extension> 
        <Target></Target> 
        <Prompt>Hello</Prompt> 
        <MatchLimit>50</MatchLimit> 
        <ResultColumns> 
               
<Column><Name>c1</Name><Property>DisplayId</Property></Column> 
               
<Column><Name>c2</Name><Property>LocationDescription</Property></Column> 
        </ResultColumns> 
        <Filter>DisplayId = '%$USER_VARIABLE%'</Filter> 
  </Extension> 
  <Label></Label> 
  <Disabled/> 
</Widget> 


When I activate this widget, it pops open in a window with a search prompt
(as expected). 

So I'm dealing with a couple of problems here: 
1. If I leave the search prompt blank and click search, it always routes to
the ErrorPage.templ and then 
errors out in javascript with errors like 'mapName' is undefined. 
I added the mapName variable at line 31 so that the page could find mapName: 
var popup = %s; 
var mapName = "%s"; 

I also edited the OnError event in Search.php to be: 
function OnError($title, $msg) 
{ 
    global $target, $popup, $mapName; 
    $templ = file_get_contents("./ErrorPage.templ"); 
    print sprintf($templ, $popup, $mapName, $title, $msg); 
} 

Doing this stops the error, but then I get more errors.. I try to keep
resolving these errors, but they keep coming... so I feel like I'm going
down the wrong path here... 

2. The following option for my search widget is causing the search to route
to the ErrorPage.templ (which brings up all of the problems mentioned
above): 
<Filter>DisplayId = '%$USER_VARIABLE%'</Filter> 

When I remove this option, or to be more specific, when I remove the
percentages from it, the search works perfectly. (Of course then I am unable
to search for partial words though) 

I found another post here: 
http://osgeo-org.1803224.n2.nabble.com/Fusion-error-with-query-search-on-ApplicationDefinition-td4802652.html#a4802864

which suggests to do this: 

<Filter>DisplayId = '%25$USER_VARIABLE%25'</Filter> 

but this is still upsetting the widget. 

Can anyone provide a working example of the fusion search widget with
accompanying code? or can anyone help me out with either problem? 

3. Also, is there a way to have two clauses in the filter? DisplayId LIKE
'%blah%' OR LocationDescription LIKE '%blah%' 

Thanks in advance, 
Kellie 
  

-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Fusion-Search-widget-Error-when-using-Filter-tp5726205p5726205.html
Sent from the Fusion Users mailing list archive at Nabble.com.


More information about the fusion-users mailing list