Bug 39773: Add 'required' attribute for required fields

Test plan, apply patch:
1) Enable ILLModule
2) Create a new OPAC request, visit:
http://localhost:8080/cgi-bin/koha/opac-illrequests.pl?op=add_form&backend=Standard
3) Press 'Create'. Notice the required 'type 'is now validated before the form is submitted.

Additional testing:
1) Enable ILLOpacUnauthenticatedRequest. Log out. Repeat 2)
2) Press 'Create'. Notice the required unauthenticated fields are highlighted as required.

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 738ab3b256)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Pedro Amorim 2025-04-29 12:23:35 +00:00 committed by Paul Derscheid
parent eedb81421a
commit 665b195715
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
2 changed files with 5 additions and 5 deletions

View File

@ -111,7 +111,7 @@
<li>
<label for="captcha" class="required">Verification:</label>
<input type="text" name="captcha" id="captcha" class="form-control input-fluid" style="text-transform: uppercase;" />
<input required type="text" name="captcha" id="captcha" class="form-control input-fluid" style="text-transform: uppercase;" />
<div class="required_label required">Required</div>
<input type="hidden" name="captcha_digest" value="[% captcha_digest | html %]" />

View File

@ -3,9 +3,9 @@
<li>
<label for="[% id | html %]">[% label | html %]:</label>
[% IF opac %]
<input class="form-control input-fluid" type="text" name="[% id | html %]" id="[% id | html %]" value="[% value | html %]" />
<input [% IF required %]required[% END %] class="form-control input-fluid" type="text" name="[% id | html %]" id="[% id | html %]" value="[% value | html %]" />
[% ELSE %]
<input type="text" name="[% id | html %]" id="[% id | html %]" value="[% value | html %]" />
<input [% IF required %]required[% END %] type="text" name="[% id | html %]" id="[% id | html %]" value="[% value | html %]" />
[% END %]
[% IF required %]
<div class="required_label required">Required</div>
@ -18,11 +18,11 @@
<li>
<label for="[% id | html %]">[% label | html %]:</label>
[% IF opac %]
<select class="form-select input-fluid" name="[% id | html %]" id="[% id | html %]"
<select [% IF required %]required[% END %] class="form-select input-fluid" name="[% id | html %]" id="[% id | html %]"
>[% content | $raw %]</select
>
[% ELSE %]
<select name="[% id | html %]" id="[% id | html %]"
<select [% IF required %]required[% END %] name="[% id | html %]" id="[% id | html %]"
>[% content | $raw %]</select
>
[% END %]