Tags:
create new tag
, view all tags

Question

I am trying to perform a search using a URL parameter that can have multiple values. I am currently using the following code to do so:

  %SEARCH{"Status.*value\=.*(%URLPARAM{"Status" multiple="($item)" separator="|" encode="entity"}%)" scope="text" regex="on" excludetopic="TicketTemplate" nosearch="on" nototal="on" order="formfield(Priority)" casesensitive="off" expandvariables="on" format="| [[$topic]] | $formfield(Priority) | $formfield(Title) | $formfield(Status) | $formfield(RequestedBy) | $formfield(AssignedTo) | $formfield(CreateDate) | $formfield(CloseDate) |"}%

This setup works properly when I select one value from the selection box or when I hardcode multiple values into the search string (in place of the URLPARAM variable). However, when I select multiple values in the selection box, I get no results. I have checked the output of the URLPARAM variable and it matches the values I am hardcoding exactly. This really seems like a bug to me, though I hope it isn't.

Thanks in advance.

Environment

TWiki version: TWikiRelease04x01x02
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin
Server OS:  
Web server:  
Perl version:  
Client OS:  
Web Browser:  
Categories: Forms, Search

-- KevinCraft - 15 Dec 2007

Answer

ALERT! If you answer a question - or have a question you asked answered by someone - please remember to edit the page and set the status to answered. The status is in a drop-down list below the edit box.

I think http://develop.twiki.org/~twiki4/cgi-bin/view/Bugs/AllOutStandingItems?raw=debug should help you - that topic allows you to select multiples.

-- SvenDowideit - 15 Dec 2007

Thanks for the link. I played with it for a little while and couldn't seem to get that method to work, either. I'm not sure what I'm doing wrong...

Let me explain what I am doing in more detail.

I am creating a ticket/issue tracking system. I have a form called TicketForm and a template called TicketTemplate. Tickets topics are named TicketXXXX, where XXXX is an autoinc number generated by TWiki.

I am trying to create a TicketReport that allows users to filter the tickets according to their criteria. The field that is giving me trouble is the Status field, which has "New", "Assigned", "Working", "Ready", "Released", and "Cancelled" as possible values. It is imperitive that users are able to filter by more than one status at a time because it is likely that they will want to view all open tickets, which would include New, Assigned, Working, and Ready tickets. To do this, I am presenting a multiple selection box. I then use the SEARCH variable with the settings shown at the beginning of this topic to build the table of tickets that match the user's filter. Those parameters work perfectly if I replace URLPARAM with "(New)|(Assigned)|(Working)|(Ready)" (i.e. I hardcode the values). However, if I use URLPARAM, it always returns nothing. This is strange because if I just print URLPARAM, it renders as "(New)|(Assigned)|(Working)|(Ready)" just as it is when I hardcode it. I don't understand why this does not produce the same results as the hardcoded string.

-- KevinCraft - 15 Dec 2007

I found the problem. It is because I was using encode="entity" in the URLPARAM variable. The pipes (|) were getting encoded.

I believe this is a design flaw because the separator is specified by the user and can be manually escaped if necessary (i.e. define the separator as &#XX; rather than |). The current setup makes it impossible for the user to escape the URL parameters and not the separators. It is all or nothing.

-- KevinCraft - 15 Dec 2007

 
Change status to:
Topic revision: r3 - 2007-12-15 - KevinCraft
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.