WordPress.org

Make WordPress Core

Opened 19 months ago

Closed 19 months ago

Last modified 19 months ago

#21984 closed defect (bug) (invalid)

Adding a placeholder to searchform.php breaks form submission.

Reported by: mwilliam Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.4.2
Component: General Keywords:
Focuses: Cc:

Description

Without a placeholder attibute, the form submits successfully ("?s=[search-term]"):

    <form role="search" method="get" id="searchform" action="<?php bloginfo('url');?>/">
        <div>
            <label class="screen-reader-text" for="s">Search for:</label>
            <input type="text" value="" name="s" id="s">
            <input type="submit" id="searchsubmit" value="Search">
        </div>
    </form>

With a placeholder attibute, however, the form submits blank ("?s=") regardless of the presence of the value attribute:

    <form role="search" method="get" id="searchform" action="<?php bloginfo('url');?>/">
        <div>
            <label class="screen-reader-text" for="s">Search for:</label>
            <input type="text" value="" placeholder="Search" name="s" id="s">
            <input type="submit" id="searchsubmit" value="Search">
        </div>
    </form>

This is a bug on all modern browsers (legacy is excluded because the placeholder attribute is not supported).

Change History (4)

comment:1 nacin19 months ago

Not sure I see how this is a WordPress bug?

comment:2 mwilliam19 months ago

Well, it works in 3.4.1. How is this not a WP bug?

Version 0, edited 19 months ago by mwilliam (next)

comment:3 mwilliam19 months ago

  • Resolution set to invalid
  • Status changed from new to closed

comment:4 helenyhou19 months ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.