question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Submit and clear buttons for search field

See original GitHub issue

On my project I wanted the search field for each table to have optional dedicated submit and clear buttons and I figured I’d see if this would be a wanted feature.

Here is my initial update

This happened to coincide with your big theme overhaul. I’m not sure if it will be possible to generalize the HTML syntax for all of the these because each UI framework constructs the input-group differently. So far I’ve verified with Bootstrap 4 but have coded up the configurations for Bootstrap 3 and Bulma. I had to take a little liberties so far (i.e. a useless div around the input search field only because Bulma needs it). Before I continue integrating the other UI frameworks let me know if you’d think this would be a good addition. If so, I’ll put up some jsFiddles to demonstrate the new functionality.

Here is how the search field will be rendered in the three currently implemented UI frameworks:

<!-- bulma -->
<div class="float-right search">
    <div class="field has-addons">
        <div class="control">
            <input class="input" type="text" placeholder="Search">
        </div>
        <div class="control">
            <button type="button" class="button" name="search" aria-label="Search" title="Submit Search"><i class="fa fa-search"></i></button>
        </div>
        <div class="control">
            <button type="button" class="button" name="clearSearch" aria-label="Clear Search" title="Clear Search"><i class="fa fa-times"></i></button>
        </div>
    </div>
</div>

<!-- bootstrap 3 -->
<div class="float-right search">
    <div class="input-group">
        <div class="">
            <input class="form-control" type="text" placeholder="Search">
        </div>
        <div class="input-group-btn">
            <button class="btn btn-secondary" type="button" name="search" aria-label="Search" title="Submit Search"><i class="glyphicon glyphicon-search"></i></button>
        </div>
        <div class="input-group-btn">
            <button class="btn btn-secondary" type="button" name="clearSearch" aria-label="Clear Search" title="Clear Search"><i class="glyphicon glyphicon-remove"></i></button>
        </div>
    </div>
</div>

<!-- bootstrap 4 -->
<div class="float-right search">
    <div class="input-group">
        <div class="">
            <input class="form-control" type="text" placeholder="Search">
        </div>
        <div class="input-group-append">
            <button class="btn btn-secondary" type="button" name="search" aria-label="Search" title="Submit Search"><i class="fa fa-search"></i></button>
        </div>
        <div class="input-group-append">
            <button class="btn btn-secondary" type="button" name="clearSearch" aria-label="Clear Search" title="Clear Search"><i class="fa fa-times"></i></button>
        </div>
    </div>
</div>

These options can be enabled with boolean fields ‘searchButton’ and ‘clearSearchButton’.

I think it would be best to make these attached to the search field (so it is clear they operate on the it and not the table like the other toolbar buttons) but if it can’t be done generally for every theme then they can just be attached to the general toolbar if ‘search’ is enabled.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
UtechtDustincommented, Jun 4, 2019

Im working on it and its already implemented, only the templates for the css frameworks are missing. Will send a PR tomorrow.

0reactions
UtechtDustincommented, May 31, 2019

Any news here @doug-the-guy ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Submit & Reset Buttons - The complete HTML5 tutorial
The submit-button must always be the last value selected, as it initiates the form submission whereas the reset-button can be pressed at all...
Read more >
Should a search page have a clear button?
The button should be labeled “Clear” or maybe “Clear All.” Some web apps use “Reset” but “Reset” means reverting the form to the...
Read more >
Always Provide a Submit Button Adjacent to the Search Field ...
Our large-scale Mobile UX study reveals that the absence of an explicit submit button adjacent to the search field causes significant ...
Read more >
<input type="reset"> - HTML: HyperText Markup Language
elements of type reset are rendered as buttons, with a default click event handler that resets all inputs in the form to their...
Read more >
How to put a responsive clear button inside HTML input text field
The responsive button inside an input field will clear the text area on the click event. In this article, we will discuss how...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found