Bug 9139: New subscription form - Does not check form on the first page

The vendor and Record input try to sent the form if the focus is on the
inputs (normal behavior).
But the form is on 2 pages, and the popup message ask you to fill info
on the second page when you are on the first one. This does not make
sense.

This patch suggests to launch search when the enter key is press on
these inputs.

Test plan:
1/ Create a new subscription
2/ Put the focus in the Vendor input and press enter: the vendor search
popup should appear
3/ Put the focus in the Record input and press enter: the record search
popup should appear

Signed-off-by: Andreas Hedström Mace <andreas.hedstrom.mace@sub.su.se>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Jonathan Druart 2015-04-08 16:21:15 +02:00 committed by Tomas Cohen Arazi
parent 1d403fa465
commit b678c7359e

View file

@ -374,6 +374,18 @@ function show_page_2() {
$(document).ready(function() {
$("#aqbooksellerid").on('keypress', function(e) {
if (e.keyCode == 13) {
e.preventDefault();
FindAcqui();
}
});
$("#biblionumber").on('keypress', function(e) {
if (e.keyCode == 13) {
e.preventDefault();
Plugin();
}
});
$("select#frequency").change(function(){
patternneedtobetested = 1;
$("input[name='enddate']").val('');
@ -479,7 +491,7 @@ $(document).ready(function() {
[% END %]
<li>
<label for="aqbooksellerid">Vendor: </label>
<input type="text" name="aqbooksellerid" id="aqbooksellerid" value="[% aqbooksellerid %]" size="8" /> (<input type="text" name="aqbooksellername" value="[% aqbooksellername %]" disabled="disabled" readonly="readonly" />) <a href="#" onclick="FindAcqui(f)">Search for a vendor</a>
<input type="text" name="aqbooksellerid" id="aqbooksellerid" value="[% aqbooksellerid %]" size="8" /> (<input type="text" name="aqbooksellername" id="aqbooksellername" value="[% aqbooksellername %]" disabled="disabled" readonly="readonly" />) <a href="#" onclick="FindAcqui(f)">Search for a vendor</a>
</li>
<li>
<label for="biblionumber" class="required" title="Subscriptions must be associated with a bibliographic record">Record:</label>