WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 2 years ago

#37540 closed enhancement (fixed)

validateForm does not validate textarea or select inputs

Reported by: shadyvb Owned by: swissspidy
Milestone: 4.8 Priority: normal
Severity: normal Version: 4.6
Component: Administration Keywords: has-patch
Focuses: ui, javascript Cc:

Description

validateForm only looks for <input /> elements and ignores select and textarea fields.

Steps to reproduce:

  • Add a select or textarea input to term edit page/form, add 'form-required' class to their wrappers
  • Leave the new field(s) empty
  • Click the submit button

Expected behavior:

  • Form is not submitted, because required fields are not filled out

Actual result:

  • Form validation passes and form is submitted

Recommended change:

  • Change input:visible to :input:visible so it covers select and textarea as well.

Attachments (1)

37540.patch (649 bytes) - added by shadyvb 3 years ago.

Download all attachments as: .zip

Change History (6)

@shadyvb
3 years ago

#1 @lukecavanagh
3 years ago

@shadyvb

Patch applies cleanly without any errors.

#2 @swissspidy
3 years ago

  • Component changed from General to Administration
  • Focuses administration removed
  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 4.8

This ticket was mentioned in Slack in #core by jeffpaul. View the logs.


2 years ago

#4 @swissspidy
2 years ago

  • Owner set to swissspidy
  • Status changed from new to assigned

#5 @swissspidy
2 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 40634:

Administration: Ensure validateForm also validates other input fields.

With this change, textareas and select inputs will be checked as well.

Props shadyvb.
Fixes #37540.

Note: See TracTickets for help on using tickets.