Make WordPress Core

Opened 7 years ago

Last modified 5 years ago

#38424 new defect (bug)

Custom form taxonomy field doesn't clear after added...

Reported by: sgr33n's profile SGr33n Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 2.9
Component: Taxonomy Keywords: has-patch
Focuses: Cc:

Description

Hi,

I was adding a new taxonomy field via the action {$taxonomy}_add_form_fields.
Anyway if the input type is 'url', after added the new taxonomy the form field doesn't clear itself, and in the url field will remain the inserted value.

This doesn't happen if the input type = text.

Thanks.

Attachments (4)

38424.diff (534 bytes) - added by boonebgorges 7 years ago.
38424-ver2.diff (18.9 KB) - added by SGr33n 7 years ago.
38424-ver3.diff (582 bytes) - added by SGr33n 7 years ago.
38424-ver4.diff (614 bytes) - added by SGr33n 7 years ago.

Download all attachments as: .zip

Change History (9)

#1 @boonebgorges
7 years ago

  • Keywords has-patch 2nd-opinion added
  • Milestone changed from Awaiting Review to Future Release

The JS has targeted type="text" only since [11676]. https://core.trac.wordpress.org/browser/tags/4.6.1/src/wp-admin/js/tags.js?marks=66#L66

I don't think we can drop input because it has the potential to mess with radio buttons and checkboxes that may set their own default values. Adding type="url" to the selector seems harmless, though. See 38424.diff.

Anyone see a problem with this?

@boonebgorges
7 years ago

#2 @SGr33n
7 years ago

Thanks, I also added number, email and tel, that also should be harmless. Anyway, since atm I don't have svn, I modified your patch via text editor, I hope it works.

@SGr33n
7 years ago

#3 @SGr33n
7 years ago

My previous patch didn't work, the correct one is the ver4.
Thanks! :)

Last edited 7 years ago by SGr33n (previous) (diff)

@SGr33n
7 years ago

@SGr33n
7 years ago

#4 @afercia
7 years ago

  • Keywords 2nd-opinion removed
  • Version changed from 4.7 to 2.9

Not sure why the current code checks also for :visible; what about just resetting the form? E.g.:
form[0].reset()

  • any field within the form would be reset, even the custom ones added via filters
  • this would also preserve radio buttons and checkboxes that may set their own default values

#5 @SGr33n
5 years ago

Up, no committed yet, bug still happening :(

Note: See TracTickets for help on using tickets.