Skip to content

Commit

Permalink
WebHost: Fix "Add" button for custom option values causing a weird re…
Browse files Browse the repository at this point in the history
…direct (ArchipelagoMW#3518)

* WebHost: Fix "Add" button for Progression Balancing causing a weird redirect

This "add" button is part of a form, which causes it to submit the form, because the default type for a button is "submit".

This PR changes the type of the button to "button", which causes it to not submit the form and just execute its normal effect.

(An alternative would be `event.preventDefault()` but that seems less clean to me, but also I'm not a HTML/JS dev)

* There's also multiple.
  • Loading branch information
NewSoupVi authored and James Schurig committed Jun 13, 2024
1 parent c3fec99 commit c65f85d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions WebHostLib/templates/weightedOptions/macros.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
{% endif %}
<div class="add-option-div">
<input type="number" class="range-option-value" data-option="{{ option_name }}" />
<button class="add-range-option-button" data-option="{{ option_name }}">Add</button>
<button type="button" class="add-range-option-button" data-option="{{ option_name }}">Add</button>
</div>
</div>
<table class="range-rows" data-option="{{ option_name }}">
Expand All @@ -72,7 +72,7 @@
This option allows custom values only. Please enter your desired values below.
<div class="custom-value-wrapper">
<input class="custom-value" data-option="{{ option_name }}" placeholder="Custom Value" />
<button data-option="{{ option_name }}">Add</button>
<button type="button" data-option="{{ option_name }}">Add</button>
</div>
<table>
<tbody>
Expand All @@ -89,7 +89,7 @@
Custom values are also allowed for this option. To create one, enter it into the input box below.
<div class="custom-value-wrapper">
<input class="custom-value" data-option="{{ option_name }}" placeholder="Custom Value" />
<button data-option="{{ option_name }}">Add</button>
<button type="button" data-option="{{ option_name }}">Add</button>
</div>
</div>
<table>
Expand Down

0 comments on commit c65f85d

Please sign in to comment.