[wp-trac] [WordPress Trac] #21984: Adding a placeholder to searchform.php breaks form submission.

WordPress Trac wp-trac at lists.automattic.com
Mon Sep 24 16:51:42 UTC 2012


#21984: Adding a placeholder to searchform.php breaks form submission.
-----------------------------+--------------------------
 Reporter:  mwilliam         |       Type:  defect (bug)
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  General
  Version:  3.4.2            |   Severity:  normal
 Keywords:                   |
-----------------------------+--------------------------
 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).

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21984>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list