Skip to content

Loading…

Form.Radio: render gives duplicate IDs to the generated <inputs> #181

Open
nick-danger opened this Issue · 0 comments

1 participant

@nick-danger

The Radio class's render method in Form uses the same ID value in each tag it generates. A cheap fix is to insert one line at or about line 307 of form.py, thusly:

            attrs['type'] = 'radio'
            attrs['value'] = value
            attrs['id'] += '-'+value    # <-- inserted line
            if self.value == value:
                attrs['checked'] = 'checked'

Obviously, it would be better to do some sort of cleansing of the 'value' being appended to the ID to ensure it doesn't contain illegal characters. I'd have done that, but I'm not quite up to speed with the 'zen' of web.py yet. Suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.