Quantcast

Adding Custom Field drop downs to Advanced Search Page

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Adding Custom Field drop downs to Advanced Search Page

dsal
Hi,

I've added several custom fields to Bugzilla, and I'd like them to appear in the 'Advanced Search' page, as searchable fields. I know that users can currently use the 'Boolean Charts' feature to search these fields, but this is inconvenient because:

1. Most users don't find this way of searching intuitive to use.
2. Even though they can search the fields, a list of available values is not displayed for them to select from.

Is there a way to add these fields to the search as dropdowns?

Thanks in advance,

Dan
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Adding Custom Field drop downs to Advanced Search Page

Tosh, Michael J
dsal wrote:
> I've added several custom fields to Bugzilla, and I'd like them to
> appear in the 'Advanced Search' page, as searchable fields. I know
> that users can currently use the 'Boolean Charts' feature to search
> these fields, but this is inconvenient because:

Work in being, targetted for Bugzilla 4.0, to enable that functionality.
This is being handled by bug 342113.  For code to do it yourself in 3.0,
check out bug 398557, and add that in.

Links:
https://bugzilla.mozilla.org/show_bug.cgi?id=342113
https://bugzilla.mozilla.org/show_bug.cgi?id=398557

tosh
_______________________________________________
support-bugzilla mailing list
[hidden email]
https://lists.mozilla.org/listinfo/support-bugzilla
PLEASE put [hidden email] in the To: field when you reply.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Adding Custom Field drop downs to Advanced Search Page

AckDaddy
Regarding https://bugzilla.mozilla.org/show_bug.cgi?id=398557, I believe there is code missing from the examples.  The addition to PrefillForm is missing the @cf_select definition.  This leads to an internal error.  Unfortunately, I can't figure out what the syntax is to add to PrefillForm.  Any suggestions?

My code bombs here:

[% PROCESS cf_select sel = { field_obj => field, size => 7 } %]




Tosh, Michael J wrote
dsal wrote:
> I've added several custom fields to Bugzilla, and I'd like them to
> appear in the 'Advanced Search' page, as searchable fields. I know
> that users can currently use the 'Boolean Charts' feature to search
> these fields, but this is inconvenient because:

Work in being, targetted for Bugzilla 4.0, to enable that functionality.
This is being handled by bug 342113.  For code to do it yourself in 3.0,
check out bug 398557, and add that in.

Links:
https://bugzilla.mozilla.org/show_bug.cgi?id=342113
https://bugzilla.mozilla.org/show_bug.cgi?id=398557

tosh
_______________________________________________
support-bugzilla mailing list
support-bugzilla@lists.mozilla.org
https://lists.mozilla.org/listinfo/support-bugzilla
PLEASE put support-bugzilla@lists.mozilla.org in the To: field when you reply.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Adding Custom Field drop downs to Advanced Search Page

St. John-2
In reply to this post by dsal
I had some fun with this one too.  The cf_select code is included in
Comment #4 of the same bug.  When you put them both together, they get
along like a house on fire.

Yours triskaidekaphobically,
J3

On Aug 25, 1:28 pm, AckDaddy <[hidden email]> wrote:

> Regardinghttps://bugzilla.mozilla.org/show_bug.cgi?id=398557, I believe
> there is code missing from the examples.  The addition to PrefillForm is
> missing the @cf_select definition.  This leads to an internal error.
> Unfortunately, I can't figure out what the syntax is to add to PrefillForm.
> Any suggestions?
>
> My code bombs here:
>
> [% PROCESS cf_select sel = { field_obj => field, size => 7 } %]
>
>
>
> Tosh, Michael J wrote:
>
> > dsal wrote:
> >> I've added several custom fields to Bugzilla, and I'd like them to
> >> appear in the 'Advanced Search' page, as searchable fields. I know
> >> that users can currently use the 'Boolean Charts' feature to search
> >> these fields, but this is inconvenient because:
>
> > Work in being, targetted for Bugzilla 4.0, to enable that functionality.
> > This is being handled by bug 342113.  For code to do it yourself in 3.0,
> > check out bug 398557, and add that in.
>
> > Links:
> >https://bugzilla.mozilla.org/show_bug.cgi?id=342113
> >https://bugzilla.mozilla.org/show_bug.cgi?id=398557
>
> > tosh
> > _______________________________________________
> > support-bugzilla mailing list
> > [hidden email]
> >https://lists.mozilla.org/listinfo/support-bugzilla
> > PLEASE put [hidden email] in the To: field when you
> > reply.
>
> --
> View this message in context:http://www.nabble.com/Adding-Custom-Field-drop-downs-to-Advanced-Sear...
> Sent from the Bugzilla - Users mailing list archive at Nabble.com.

_______________________________________________
support-bugzilla mailing list
[hidden email]
https://lists.mozilla.org/listinfo/support-bugzilla
PLEASE put [hidden email] in the To: field when you reply.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Adding Custom Field drop downs to Advanced Search Page

[% END %]


<hr>

[%# *** Custom Drop-down Fields *** %]

AckDaddy
Not sure how I missed that, I guess I needed an extra set of eyes.  Thanks.

For reference and for anyone else that needs searching of custom fields, here is the aggregated code that I ended up adding (note, only custom fields I have are drop down boxes.  Additional code is required for free text or select fields.  See bug referenced above for additional details):

In template/en/custom/search/form.html.tmpl:

[%############################################################################%]
[%# Block for Custom SELECT fields
#%]
[%############################################################################%]

[% BLOCK cf_select %]
 
    <select name="[% sel.field_obj.name %]" id="[% sel.field_obj.name %]"
            multiple="multiple" size="[% sel.size %]">
      [% FOREACH name = sel.field_obj.legal_values %]
        <option value="[% name FILTER html %]">
        [% name FILTER html %]
        </option>
      [% END %]
    </select>
 
      [% USE Bugzilla %]
    [% cf_fields = Bugzilla.get_fields({ obsolete => 0, custom => 1, type =>constants.FIELD_TYPE_SINGLE_SELECT }) %]
    [% IF cf_fields %]
      [% count = 0 %]
      [% FOREACH field = cf_fields %]
        [% count = count + 1 %]
                [% "" IF (count % 5) == 0 %]
      [% END %]
    [% END %]
 
                                                                          [% PROCESS cf_select sel = { field_obj => field, size => 7 } %]
                     
                <label for="[% field.name FILTER html %]" accesskey="a">[%field_descs.${field.name} %]</label>:
             
       

<hr>

In PrefillForm() in /var/www/html/bugzilla/query.cgi:

    my @cf_fields = Bugzilla::get_fields({ custom => 1, obsolete => 0 });
    foreach my $field (@cf_fields) {
        $default{$field->name} = [];
    }




dadarabbit wrote
I had some fun with this one too.  The cf_select code is included in
Comment #4 of the same bug.  When you put them both together, they get
along like a house on fire.

Yours triskaidekaphobically,
J3

On Aug 25, 1:28 pm, AckDaddy <scott.acker...@gmail.com> wrote:
> Regardinghttps://bugzilla.mozilla.org/show_bug.cgi?id=398557, I believe
> there is code missing from the examples.  The addition to PrefillForm is
> missing the @cf_select definition.  This leads to an internal error.
> Unfortunately, I can't figure out what the syntax is to add to PrefillForm.
> Any suggestions?
>
> My code bombs here:
>
> [% PROCESS cf_select sel = { field_obj => field, size => 7 } %]
>
>
>
> Tosh, Michael J wrote:
>
> > dsal wrote:
> >> I've added several custom fields to Bugzilla, and I'd like them to
> >> appear in the 'Advanced Search' page, as searchable fields. I know
> >> that users can currently use the 'Boolean Charts' feature to search
> >> these fields, but this is inconvenient because:
>
> > Work in being, targetted for Bugzilla 4.0, to enable that functionality.
> > This is being handled by bug 342113.  For code to do it yourself in 3.0,
> > check out bug 398557, and add that in.
>
> > Links:
> >https://bugzilla.mozilla.org/show_bug.cgi?id=342113
> >https://bugzilla.mozilla.org/show_bug.cgi?id=398557
>
> > tosh
> > _______________________________________________
> > support-bugzilla mailing list
> > support-bugzi...@lists.mozilla.org
> >https://lists.mozilla.org/listinfo/support-bugzilla
> > PLEASE put support-bugzi...@lists.mozilla.org in the To: field when you
> > reply.
>
> --
> View this message in context:http://www.nabble.com/Adding-Custom-Field-drop-downs-to-Advanced-Sear...
> Sent from the Bugzilla - Users mailing list archive at Nabble.com.

_______________________________________________
support-bugzilla mailing list
support-bugzilla@lists.mozilla.org
https://lists.mozilla.org/listinfo/support-bugzilla
PLEASE put support-bugzilla@lists.mozilla.org in the To: field when you reply.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Adding Custom Field drop downs to Advanced Search Page

Billy Lazzaro
In reply to this post by St. John-2
Super helpful.  Thanks for posting all you findings!

On Aug 26, 1:13 pm, AckDaddy <[hidden email]> wrote:

> Not sure how I missed that, I guess I needed an extra set of eyes.  Thanks.
>
> For reference and for anyone else that needs searching of custom fields,
> here is the aggregated code that I ended up adding (note, only custom fields
> I have are drop down boxes.  Additional code is required for free text or
> select fields.  See bug referenced above for additional details):
>
> In template/en/custom/search/form.html.tmpl:
>
> [%############################################################################%]
> [%# Block for Custom SELECT fields
> #%]
> [%############################################################################%]
>
> [% BLOCK cf_select %]
>   <td align="left">
>     <select name="[% sel.field_obj.name %]" id="[% sel.field_obj.name %]"
>             multiple="multiple" size="[% sel.size %]">
>       [% FOREACH name = sel.field_obj.legal_values %]
>         <option value="[% name FILTER html %]">
>         [% name FILTER html %]
>         </option>
>       [% END %]
>     </select>
>   </td>
> [% END %]
>
> <hr>
>
> [%# *** Custom Drop-down Fields *** %]
>
> <table>
>   <tr>
>     [% USE Bugzilla %]
>     [% cf_fields = Bugzilla.get_fields({ obsolete => 0, custom => 1, type
> =>constants.FIELD_TYPE_SINGLE_SELECT }) %]
>     [% IF cf_fields %]
>       [% count = 0 %]
>       [% FOREACH field = cf_fields %]
>         [% count = count + 1 %]
>         <td>
>           <table>
>             <tr>
>               <th align="left">
>                 <label for="[% field.name FILTER html %]"
> accesskey="a">[%field_descs.${field.name} %]</label>:
>               </th>
>             </tr>
>             <tr valign="top">
>               [% PROCESS cf_select sel = { field_obj => field, size => 7 }
> %]
>             </tr>
>           </table>
>         </td>
>         [% "</tr><tr>" IF (count % 5) == 0 %]
>       [% END %]
>     [% END %]
>   </tr>
> </table>
>
> <hr>
>
> In PrefillForm() in /var/www/html/bugzilla/query.cgi:
>
>     my @cf_fields = Bugzilla::get_fields({ custom => 1, obsolete => 0 });
>     foreach my $field (@cf_fields) {
>         $default{$field->name} = [];
>     }
>
>
>
> dadarabbit wrote:
>
> > I had some fun with this one too.  The cf_select code is included in
> > Comment #4 of the same bug.  When you put them both together, they get
> > along like a house on fire.
>
> > Yours triskaidekaphobically,
> > J3
>
> > On Aug 25, 1:28 pm, AckDaddy <[hidden email]> wrote:
> >> Regardinghttps://bugzilla.mozilla.org/show_bug.cgi?id=398557, I believe
> >> there is code missing from the examples.  The addition to PrefillForm is
> >> missing the @cf_select definition.  This leads to an internal error.
> >> Unfortunately, I can't figure out what the syntax is to add to
> >> PrefillForm.
> >> Any suggestions?
>
> >> My code bombs here:
>
> >> [% PROCESS cf_select sel = { field_obj => field, size => 7 } %]
>
> >> Tosh, Michael J wrote:
>
> >> > dsal wrote:
> >> >> I've added several custom fields to Bugzilla, and I'd like them to
> >> >> appear in the 'Advanced Search' page, as searchable fields. I know
> >> >> that users can currently use the 'Boolean Charts' feature to search
> >> >> these fields, but this is inconvenient because:
>
> >> > Work in being, targetted for Bugzilla 4.0, to enable that
> >> functionality.
> >> > This is being handled by bug 342113.  For code to do it yourself in
> >> 3.0,
> >> > check out bug 398557, and add that in.
>
> >> > Links:
> >> >https://bugzilla.mozilla.org/show_bug.cgi?id=342113
> >> >https://bugzilla.mozilla.org/show_bug.cgi?id=398557
>
> >> > tosh
> >> > _______________________________________________
> >> > support-bugzilla mailing list
> >> > [hidden email]
> >> >https://lists.mozilla.org/listinfo/support-bugzilla
> >> > PLEASE put [hidden email] in the To: field when you
> >> > reply.
>
> >> --
> >> View this message in
> >> context:http://www.nabble.com/Adding-Custom-Field-drop-downs-to-Advanced-Sear...
> >> Sent from the Bugzilla - Users mailing list archive at Nabble.com.
>
> > _______________________________________________
> > support-bugzilla mailing list
> > [hidden email]
> >https://lists.mozilla.org/listinfo/support-bugzilla
> > PLEASE put [hidden email] in the To: field when you
> > reply.
>
> --
> View this message in context:http://www.nabble.com/Adding-Custom-Field-drop-downs-to-Advanced-Sear...
> Sent from the Bugzilla - Users mailing list archive at Nabble.com.

_______________________________________________
support-bugzilla mailing list
[hidden email]
https://lists.mozilla.org/listinfo/support-bugzilla
PLEASE put [hidden email] in the To: field when you reply.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Adding Custom Field drop downs to Advanced Search Page

TrishB
does anybody know how to get this working in Bugzilla 3.4.1?

I can get my custom field list to appear on the Search page with its values, but when I make a selection from that list, it's not included in the search.
Loading...