Hello,
<select id="test" name="num" onchange="this.form.submit()">
<option value=""> ---------------------------- Not Selected ---------------------------- </option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
If you select the HTML select value with the above code, I made it to submit to django without a button, but the value is initialized to Not Selected after submission, is there any way to keep the value selected? I have a question.
html django
Whether the form submit method is GET
or POST
is unknown on the attached code, but
If submit should occur every time the select option is changed, do not call form.submit() from the
change
event handler in the select
element and write your own Ajax call.
https://codepen.io/digda/pen/ZEbLaXE
However, this will force cumbersome work.
In the case of using the existing form submission, the contents in the form are automatically sent in a form suitable for the method, whereas
If you make Ajax and call it directly, you have to collect the data to be shipped one by one and put it in manually.
548 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
538 Uncaught (inpromise) Error on Electron: An object could not be cloned
546 Understanding How to Configure Google API Key
549 PHP ssh2_scp_send fails to send files as intended
547 Who developed the "avformat-59.dll" that comes with FFmpeg?
© 2024 OneMinuteCode. All rights reserved.