Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have form as given below. Now, when I enter something in the #search_string and press ENTER button it automatically takes it to the action=Paid... I'm not sure why the form gets submitted on the ENTER button..

   <!--<div id="startsearchbox">-->
            <form id="bigsearchform_new" method="post" action="Paid">
                    <!--<label style="display:none" for="search_string">SEARCH</label>-->
                    <input id="search_string" name="search_string" type="text" class="startnewsearch rounded" placeholder="Search..." maxlength="500" >
                    <input id="searchButton1"  type="button" class="searchButton" title="Click here to search the database">
                    <input type="hidden" name="antiCSRF" value="{{acsrf}}" />
                    <input type="hidden" name="session_id" value="{{session_id}}" />
                    <input type="hidden" name="commodity_id" id="commodity_id" />
            </form>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
277 views
Welcome To Ask or Share your Answers For Others

1 Answer

It's default behavior of the browser to submit the form on ENTER button. If you want to prevent form submitssion use onSubmit event handler.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...