Update public source
This commit is contained in:
@@ -85,6 +85,8 @@
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
||||
<span id="selected-method-label"></span>
|
||||
|
||||
<input
|
||||
type="hidden"
|
||||
name="method_version"
|
||||
@@ -98,14 +100,23 @@
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const methodSelect = document.getElementById("method_id");
|
||||
const versionInput = document.getElementById("method_version");
|
||||
const selectedMethodLabel = document.getElementById("selected-method-label");
|
||||
|
||||
if (!methodSelect || !versionInput) {
|
||||
if (!methodSelect || !versionInput || !selectedMethodLabel) {
|
||||
return;
|
||||
}
|
||||
|
||||
methodSelect.addEventListener("change", function () {
|
||||
const updateSelectedMethodLabel = function () {
|
||||
const selectedOption = methodSelect.options[methodSelect.selectedIndex];
|
||||
versionInput.value = selectedOption.dataset.version || "";
|
||||
selectedMethodLabel.textContent =
|
||||
"Selected: " + selectedOption.textContent.trim();
|
||||
};
|
||||
|
||||
updateSelectedMethodLabel();
|
||||
|
||||
methodSelect.addEventListener("change", function () {
|
||||
updateSelectedMethodLabel();
|
||||
methodSelect.form.requestSubmit();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user