WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 4 years ago

#20110 closed enhancement

Add a valued() function to encourage consistency in input fields — at Version 1

Reported by: jeremyfelt Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Template Keywords: close
Focuses: Cc:

Description (last modified by helenyhou)

A valued() function would fit well with the helper functions selected() and checked().

Makes it easier to add a value if it exists, and to escape the value with esc_attr().

Makes it easier to provide a placeholder text.

Use would be:

<input type="text" <?php valued( $possible_num, true, '4 digit number' ); ?>>

Which would result in:

<input type="text" value="1234" placeholder="4 digit number">

Or

<input type="text" placeholder="4 digit number">

(Depending on the original value of $possible_num)

Change History (2)

@jeremyfelt4 years ago

comment:1 @helenyhou4 years ago

  • Description modified (diff)
Note: See TracTickets for help on using tickets.