views:

10

answers:

1

I have done this using javascript for the edit bug page, where I used a change of the bug status to modify the default text. This was done by calling a javascript function onchange of the bug status. I am now trying to do a similar operation on the enter bug page, but I need the default text to change based on the issue type. As this is a custom field it does not show up in the template files, so I cant (that I am aware of) use the onchange in the select tag for the issue type drop down menu. Is there another way of using the onchange feature to call a javascript function?

Thanks

A: 

The way that I have accomplished something similar is to modify field.html.tmpl which is where the HTML for the custom fields is rendered. You would find the place in the code where it is rendering your field (e.g. [% CASE [constants.FIELD_TYPE_SINGLE_SELECT). Then you could add in your own code to include an onchange handler as appropriate for your particular situation.

Something like this (note: Bugzilla 3.2.3):

[% CASE [ constants.FIELD_TYPE_SINGLE_SELECT 
          constants.FIELD_TYPE_MULTI_SELECT ] %]
    <select id="[% field.name FILTER html %]" 
            name="[% field.name FILTER html %]" 
            [% IF field.type == constants.FIELD_TYPE_MULTI_SELECT %]
                [% SET field_size = 5 %]
                [% IF field.legal_values.size < 5 %]
                    [% SET field_size = field.legal_values.size %]
                [% END %]
                size="[% field_size FILTER html %]" multiple="multiple"
            [% END %]

            [%# BEGIN ADDED CODE %]
            [% IF field.name == 'cf_mycustomissuetypefield' %]
                onchange="javascript:updateDescription()"
            [% END %]
            [%# END ADDED CODE %]
            >
Scott W
Thats worked thanks, I had just been looking in the wrong places for the select tag.