0

I have a form with 2 submit buttons that look like this:

<select class="form-select" name="modelsz" id="modelsz">
                <option selected>{{found_model}}</option>
                {% for i_model in searched_model %}
                    <option>{{i_model}}</option>
                {% endfor %}
            </select>
<button type="submit" name="chooseModel" class="btn btn-outline-success" value="Confirm">Confirm</button>
...
<input type="text" class="form-control" placeholder="Symbol" name="symbolsz" id="symbolsz" value={{found_symbol}}>
<button type="submit" name="searchProduct" class="btn btn-outline-success" value="Search">Search</button>

There is no problem in handling both of them in one form but I can't figure out how to change default button when using "enter" key on my keyboard. Every time I press "enter" it chooses first button

Jorhanc
  • 310
  • 2
  • 13
  • You would find [Multiple submit buttons in an HTML form](https://stackoverflow.com/questions/48/multiple-submit-buttons-in-an-html-form) helpful. Also I found the solution [here](https://www.tjvantoll.com/2013/01/01/enter-should-submit-forms-stop-messing-with-that/#explicit-prevention) a bit below where the link shows helpful. – Abdul Aziz Barkat Jan 20 '21 at 08:43
  • @AbdulAzizBarkat dont post answers in comments, comments are used for clarification or improvement suggestions. – SLDem Jan 20 '21 at 08:45

0 Answers0