Adding Custom Field drop downs to Advanced Search Page

View: New views
7 Messages — Rating Filter:   Alert me  

Adding Custom Field drop downs to Advanced Search Page

by dsal :: Rate this Message:

| View Threaded | Show Only this Message

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

RE: Adding Custom Field drop downs to Advanced Search Page

by Tosh, Michael J :: Rate this Message:

| View Threaded | Show Only this Message

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@...
https://lists.mozilla.org/listinfo/support-bugzilla
PLEASE put support-bugzilla@... in the To: field when you reply.

RE: Adding Custom Field drop downs to Advanced Search Page

by AckDaddy :: Rate this Message:

| View Threaded | Show Only this Message

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.

Parent Message unknown Re: Adding Custom Field drop downs to Advanced Search Page

by St. John-2 :: Rate this Message:

| View Threaded | Show Only this Message

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...@...> 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...@...
> >https://lists.mozilla.org/listinfo/support-bugzilla
> > PLEASE put support-bugzi...@... 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@...
https://lists.mozilla.org/listinfo/support-bugzilla
PLEASE put support-bugzilla@... in the To: field when you reply.

Re: Adding Custom Field drop downs to Advanced Search Page

by AckDaddy :: Rate this Message:

| View Threaded | Show Only this Message

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 <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.

Parent Message unknown Re: Adding Custom Field drop downs to Advanced Search Page

by Billy Lazzaro :: Rate this Message:

| View Threaded | Show Only this Message

Super helpful.  Thanks for posting all you findings!

On Aug 26, 1:13 pm, AckDaddy <scott.acker...@...> 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 <scott.acker...@...> 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...@...
> >> >https://lists.mozilla.org/listinfo/support-bugzilla
> >> > PLEASE put support-bugzi...@... 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-bugzi...@...
> >https://lists.mozilla.org/listinfo/support-bugzilla
> > PLEASE put support-bugzi...@... 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@...
https://lists.mozilla.org/listinfo/support-bugzilla
PLEASE put support-bugzilla@... in the To: field when you reply.

Re: Adding Custom Field drop downs to Advanced Search Page

by TrishB :: Rate this Message:

| View Threaded | Show Only this Message

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.