• I’ve made an admin page inside a plugin with a table which extends WP_List_Table class.
    Also, I’ve override function extra_tablenav in this way:

    public function extra_tablenav($which)
        {
            ?>
            <div class="alignleft actions daterangeactions">
                <label for="daterange-actions-picker" class="screen-reader-text"><?=__('Filter', 'iw-stats')?></label>
                <input type="search" name="date" id="daterange-actions-picker"/>
                <?php submit_button(__('Apply', 'iw-stats'), 'action', 'dodate', false); ?>
                <?php submit_button(__('Export as CSV', 'iw-stats'), 'action', 'doexport', false); ?>
            </div>
            <?php
        }

    It looks just as expected, but unfortunately when I submitting a form I’m getting a blank result on my field value (‘date’) in $_REQUEST.

    • This topic was modified 7 years, 3 months ago by iworb.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator bcworkz

    (@bcworkz)

    tablenav output is outside of the page’s form element, so input fields are not recognized as form data. Parameters need to be passed as URL parameters of a new request, which of course are then available in $_REQUEST. I suppose you could output your own mini-form. Submitting this form using the GET method would end up creating URL parameters, so it’s essentially the same thing.

    Thread Starter iworb

    (@iworb)

    Are you seriours? So why bulk actions inside form element and mine fields which is neighbour of bulk select is not? In my generated html they’re inside form and jQuery’s method ‘serialize’ works as expected. If I changed my form method to “GET” instead of “POST” there’s variable ‘date’, but it’s blank even if there’s actual value. Actually GET’s URL and jQuery’s serialized form must be the same, but they are not.

    Thread Starter iworb

    (@iworb)

    Here’s an example of generated form. Like you can see in 6th line mine function ouput inside the form.

    Thread Starter iworb

    (@iworb)

    Well, I think I’ve got it. Because of same names of inputs it was overriden and last value was sent.

    Moderator bcworkz

    (@bcworkz)

    I’m glad you found the problem. Sorry for the misinformation. I got tablenav and views mixed up. Serves me right for relying on memory!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘WP_List_Table custom filter field’ is closed to new replies.