Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

# blank option is added when choosing [select-type] custom field

Reported by: Owned by: goyamashita@… Ryan J Ollos normal BatchModifyPlugin normal batch modify blank select Peter Suter 0.12

### Description (last modified by Ryan J Ollos)

We have added a drop-down custom field. This field doesn't have blank option. When issuing or updating single ticket, we can't choose blank in this field.

To batch-modify this custom field, we selected this field in the batch modify section. Of course, field and drop-down are appeared in the batch modify section, but blank option is automatically added in the option and we can change it to blank.

This field is required field and don't want to change it to blank.

What should I do to erase blank option in the batch modify option?

Our environment:

• Trac Ver is 0.12
• Plugin Ver is 0.8

### comment:1 Changed 4 years ago by Ryan J Ollos

Description: modified (diff)

### comment:2 Changed 4 years ago by Ryan J Ollos

Description: modified (diff) batch modify, blank, dropdown → batch modify blank dropdown changed from CuriousCurmudgeon to Ryan J Ollos new → assigned

### comment:3 Changed 4 years ago by Ryan J Ollos

I've investigated and found the following:

• In batchmod.js, we need to pass false for the third parameter to createSelect(name, options, optional), in order for the blank entry to not appear. This parameter is currently set to true.
• The determiner for the blank entry should be fields['custom'], which is returned by TicketSystem.get_ticket.fields. However, this is not currently passed to JavaScript.
• Some ticket fields, such as Component, have a similar problem. These fields have fields['optional'] = False, and setting the field to blank through the ticket form is not allowed, so presumably it shouldn't be allowed through BatchModify either.

Therefore, a fix for both issues would look something like this at line 55 of batchmod.js:

td.append(createSelect(inputName, property.options, true));


->

td.append(createSelect(inputName, property.options, property.optional || !property.custom));


property is populated from the properties array, which is instantiated in query.html, however this code was moved in later versions of Trac.

It seems like the fix here is to pass an array of optional and custom values and add them to the properties array. First though, I'm going to open an ticket in Trac since this plugin is included in the Trac core for version 1.0, and see what the Trac developers have to say about the issue.

### comment:4 follow-up:  5 Changed 4 years ago by goyamashita@…

Resolution: → fixed assigned → closed

From Questioner Thank you for your help rjollos, it worked out well.

### comment:5 in reply to:  4 Changed 4 years ago by Ryan J Ollos

Cc: Peter Suter added; anonymous removed select added; dropdown removed

Replying to goyamashita@yahoo.co.jp:

From Questioner Thank you for your help rjollos, it worked out well.

Well, I didn't think that I had provided a solution. What did you find to be the solution in your case? I'm guessing that you just set optional = false. That might be a suitable workaround for your case, but of course it's not a general solution, since in some cases a blank option might be allowed (e.g. for Milestone).

I'm still considering to open a ticket in the Trac core about this, and I've cc'ed the developer who integrated the BatchModifyPlugin into the Trac core in case he has an opportunity to review and comment. Anyway I'll leave this ticket closed for now since the BatchModifyPlugin is not really maintained anymore.

### comment:6 Changed 3 years ago by Ryan J Ollos

The issue was resolved on the Trac trunk in trac:#10772 for release 1.1.2.

Last edited 3 years ago by Ryan J Ollos (previous) (diff)

### comment:7 Changed 3 years ago by Ryan J Ollos

Resolution: fixed → wontfix

### Modify Ticket

Action
as closed The owner will remain Ryan J Ollos.
The resolution will be deleted. Next status will be 'reopened'.

### Add Comment

Note: See TracTickets for help on using tickets.