Skip to content
This repository was archived by the owner on May 28, 2026. It is now read-only.

Commit fe915a1

Browse files
authored
Fix form submit button handling to exclude the language selector
The OCR submit buttons are disabled after clicking, but we don't need the same behaviour for the language switcher, and adding it there was also displaying the loading message for the other form. Bug: T416783
1 parent 863df8b commit fe915a1

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

assets/app.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function fetchLineModelsJSON () {
5757
*/
5858
function updateLineModelOptions () {
5959
const staticOptions = $lineDetectionSelect[0].options;
60-
let staticOptionData = [];
60+
let staticOptionData = [];
6161
Array.prototype.forEach.call(staticOptions, option => {
6262
staticOptionData.push({
6363
text: option.text,
@@ -70,7 +70,7 @@ function updateLineModelOptions () {
7070

7171
// append static options
7272
staticOptionData.slice(0, 2).forEach(staticOption => {
73-
$lineDetectionSelect.append(new Option(staticOption.text, staticOption.value, staticOption.value === null, false));
73+
$lineDetectionSelect.append(new Option(staticOption.text, staticOption.value, staticOption.value === null, false));
7474
});
7575

7676
// append all other line detection models as options
@@ -135,7 +135,7 @@ $(function () {
135135
}
136136
});
137137

138-
// modify selected engine after loading the page with preselected engine
138+
// modify selected engine after loading the page with preselected engine
139139
let $engineRadioFields = $('[name=engine]:checked');
140140
if($engineRadioFields.val() === 'transkribus') {
141141
$select2.attr('data-placeholder', '')
@@ -155,14 +155,14 @@ $(function () {
155155
});
156156
}
157157

158-
var submitBtns = $('.submit-btn .btn, .submit-crop')
159-
$('form').on('submit', e => {
160-
submitBtns.attr("disabled", true);
158+
const $submitBtns = $('.submit-full, .submit-crop')
159+
$submitBtns.closest('form').on('submit', e => {
160+
$submitBtns.attr("disabled", true);
161161
$(".loader").removeClass('hidden');
162162
});
163163
// Re-enable submit buttons on pagehide, so that they are re-enabled if returned to via browser history
164164
$(window).on('pagehide', e => {
165-
submitBtns.attr("disabled", false);
165+
$submitBtns.attr("disabled", false);
166166
$(".loader").addClass('hidden');
167167
});
168168

@@ -219,7 +219,7 @@ $(function () {
219219
});
220220

221221
// When submitting the main 'transcribe' button, do not send crop dimensions.
222-
$('.submit-btn .btn').on('click', e => {
222+
$('.submit-full').on('click', e => {
223223
x.value = null;
224224
y.value = null;
225225
width.value = null;

templates/output.html.twig

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@
3737
<label id="transkribus-lang-label" for="lang" class="lang-label {% if engine != 'transkribus' %}hidden{% endif %}">
3838
{{ msg('transkribus-language-code') }}
3939
</label>
40-
<select
41-
id="lang"
42-
class="form-control"
43-
name="langs[]"
44-
multiple
40+
<select
41+
id="lang"
42+
class="form-control"
43+
name="langs[]"
44+
multiple
4545
{% if engine == 'transkribus' %}
4646
required
4747
{% else %}
@@ -63,7 +63,7 @@
6363
{% include '_transkribus_options.html.twig' with {engine: engine} %}
6464

6565
<div class="form-group submit-btn">
66-
<input type="submit" value="{{ msg( 'submit' ) }}" class="btn btn-info" />
66+
<input type="submit" value="{{ msg( 'submit' ) }}" class="submit-full btn btn-info" />
6767
</div>
6868

6969
<div class="loader hidden">

0 commit comments

Comments
 (0)