Roundup Tracker - Issues

Issue 2551391

classification
checkboxes and radiobutton inputs get wrong id's.
Type: behavior Severity: normal
Components: Web interface Versions:
process
Status: fixed fixed
:
: rouilj : rouilj
Priority: :

Created on 2025-01-15 04:15 by rouilj, last changed 2025-01-16 07:38 by rouilj.

Messages
msg8271 Author: [hidden] (rouilj) Date: 2025-01-15 04:15
When I was groveling through the template code, I came across this:

def _set_input_default_args(dic):
    # 'text' is the default value anyway --
    # but for CSS usage it should be present
    dic.setdefault('type', 'text')
    # useful e.g for HTML LABELs:
    if 'id' not in dic:
        try:
            if dic['text'] in ('radio', 'checkbox'):
                dic['id'] = '%(name)s-%(value)s' % dic
            else:
                dic['id'] = dic['name']
        except KeyError:
            pass


I think dic['text'] is wrong and dic['type'] was meant.
It looks like an attempt to create a series of
checkbox/radiobutton with unique id's.

Anybody have an alternate view?
msg8283 Author: [hidden] (rouilj) Date: 2025-01-16 07:38
It's more insidious than this. The dic['text'] causes a KeyError. This is why
part of issue 1513369 exists. The KeyError prevents the else from executing
resulting in no id at all.

AFAICT it has existed since 2006 but was missed in testing 8-(.

Tests fixed and committed on changeset:   8277:669dfccca898.
History
Date User Action Args
2025-01-16 07:38:00rouiljsetstatus: new -> fixed
resolution: remind -> fixed
messages: + msg8283
2025-01-15 04:15:35rouiljsetresolution: remind
2025-01-15 04:15:22rouiljcreate