Bug 31450: Make additional contents publication date required

HTML customizations and news will not display without a publication
date, so we should make it required. This patch adds client-side
validation of the field to check that it's filled.

To test, apply the patch and go to Tools -> News (or HTML
customizations, or Pages).

- Click "New entry"
- Try to submit this new entry without entering a publication date.
- You should be prevented from submitting the form.
- Fill in the publication date and confirm that the form submits
  correctly.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 1b1e96a17c)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz>
(cherry picked from commit 65b73ac349)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Owen Leonard 2024-12-10 13:22:33 +00:00 committed by Fridolin Somers
parent 6a897acaad
commit ef8ac05c24
1 changed files with 4 additions and 3 deletions

View File

@ -222,7 +222,7 @@
[% END %]
</div>
<form id="add_additional_content" method="post" action="/cgi-bin/koha/tools/additional-contents.pl" class="validate">
<form id="add_additional_content" method="post" action="/cgi-bin/koha/tools/additional-contents.pl" class="validated">
[% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="op" value="add_validate" />
<input type="hidden" name="category" value="[% category | html %]" />
@ -262,8 +262,9 @@
</li>
[% END %]
<li>
<label for="from">Publication date: </label>
<input id="from" type="text" name="published_on" size="15" value="[% additional_content.published_on | html %]" class="flatpickr" data-date_to="to" />
<label for="from" class="required">Publication date: </label>
<input id="from" type="text" name="published_on" size="15" value="[% additional_content.published_on | html %]" class="flatpickr" data-date_to="to" required="required" class="required" />
<span class="required">Required</span>
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
<li>