Ticket #13729 (new Bug)

Opened 3 years ago

Last modified 3 years ago

z3c.formwidget.query QuerySourceRadioWidget update method should not add :list to novalue radio input name attribute

Reported by: adrianwhite Owned by:
Priority: minor Milestone: 4.x
Component: Unknown Version: 4.3
Keywords: QuerySourceRadioWidgetradio:list Cc:

Description

Radio widgets are for single values so unlike checkbox or selection widgets the name attribute on each input should never have ':list' suffix.

When a radio widget is not required the 'update' method in z3c.formwidget.query.widget.QuerySourceRadioWidget adds a "novalue" option but appends ':list' to the name attribute of the input. Doing this you end up with two radio buttons that are not related to each other.

z3c.formwidget.query-0.9 plone 4.3.1

Change History

comment:1 Changed 3 years ago by adrianwhite

last lines of the update method of QuerySourceRadioWidget class in widget.py:

        # add "novalue" option
        if self._radio and not self.required:
            self.items.insert(0, {
                'id': self.id + '-novalue',
                #'name': self.name + ':list',  # <-- :list should not be appended
                'name': self.name,
                'value': self.noValueToken,
                'label': self.noValueLabel,
                'checked': not self.value or self.value[0] == self.noValueToken,
                })
Note: See TracTickets for help on using tickets.