Prevent enter from doing a form submit on the filterable search #7240

Closed
itbeyond opened this Issue Mar 12, 2014 · 2 comments

Projects

None yet

3 participants

@itbeyond

A previous issue: prevent enter from doing a form submit on the list search filter #1068 has returned/resurfaced in 1.4.2 using the filterable widget brings this issue back where a Enter or [DONE] or [SEARCH] button on mobile devices causes the page to submit and reload. If the filterable is being used on a widget it should not submit.

Code used on my page that causes the issue in 1.4.2:

 <form class="ui-filterable">
                <input type="text" autocomplete="off" placeholder="Search for..." data-type="search" id="filterable-input" />
            </form>
            <ul id="wfList" data-filter="true" data-autodividers="true" data-input="#filterable-input" data-role="listview" data-filter-reveal="true" data-divider-theme="c"></ul>

The listview is built dynamically from AJAX and updated via refresh.

@itbeyond

Sample using the above code and showing the error: http://jsfiddle.net/7V5sc/

@gabrielschulhof gabrielschulhof added a commit that referenced this issue Mar 13, 2014
@gabrielschulhof gabrielschulhof Filterable: Prevent form submission
Intercept ENTER on keydown and preventDefault()

Fixes gh-7240
3d96d67
@gabrielschulhof gabrielschulhof added this to the 1.4.3 milestone Mar 13, 2014
@gabrielschulhof gabrielschulhof self-assigned this Mar 13, 2014
@gabrielschulhof gabrielschulhof added a commit that referenced this issue Mar 14, 2014
@gabrielschulhof gabrielschulhof Filterable: Prevent form submission
Intercept ENTER on keydown and preventDefault()

Fixes gh-7240
8fe2aa1
@gabrielschulhof gabrielschulhof added a commit that closed this issue Mar 14, 2014
@gabrielschulhof gabrielschulhof Filterable: Prevent form submission when user presses ENTER
Intercept ENTER on keydown and keypress, preventing default

Fixes gh-7240
923c1f8
@gabrielschulhof gabrielschulhof added a commit that referenced this issue Mar 14, 2014
@gabrielschulhof gabrielschulhof Filterable: Prevent form submission when user presses ENTER
Intercept ENTER on keydown and keypress, preventing default

Fixes gh-7240
5b8a14f
@LeMee
LeMee commented Sep 29, 2014

hello, unfortunately, there is not enough space on small screens to have both a search input (database query to search outside this page) and a filterable input field.
It could have been cool to have a kind of

data-prevent-submit="true" ?

I have to comment your change since 1.4.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment