Bug 32933: Use val() instead of attr("value") when getting field values with jQuery
This patch replaces instances in Koha's templates where "attr('value')" is used to get the value of a form field, using "val()" instead. This ensures that we get the current value of the field, not just the value of the field when the page first loaded. To test, apply the patch and test the following pages: - Tools -> Tags. Use the "Check lists" form in the right-hand sidebar to test the approval status of some approved and rejected tags. It should correctly respond with the tag's status. - Cataloging -> Label creator. - New -> Printer profile. Each offset and creep field should correctly reflect the selected value in the "Units" dropdown. Changing the dropdown should make the units change accordingly. - New -> Label template. Perform the same tests as above. - Tools -> Patron card creator. - New -> Layout. If necessary, check the "Field 1" checkbox. The units should be displayed correctly and change as you change the "Units" dropdown. - New -> Printer profile, - New -> Card template: Perform the same tests as above. - Lists -> List contents. - Check that the "Add to" dropdown menu works for adding selected titles to a cart or another list. - Back record modification. Submit a batch of records for modification and go to Administration -> Manage jobs. - View the details of the job you just submitted. - Confirm that the "Add modified records to the following list" dropdown works correctly. - Cataloging -> Find a bibliographic record -> Edit items. - Confirm that clicking a cell in the table of existing items triggers the "Edit item/Delete item" menu, and that these links work correctly. Works as described. Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
parent
956ae915b0
commit
9863c18cc8
10 changed files with 13 additions and 13 deletions
|
@ -54,7 +54,7 @@
|
|||
$("#add_bibs_to_list").change(function(){
|
||||
var selected = $("#add_bibs_to_list").find("option:selected");
|
||||
if ( selected.attr("class") == "shelf" ){
|
||||
var shelfnumber = selected.attr("value");
|
||||
var shelfnumber = selected.val();
|
||||
var bibs = new Array();
|
||||
[% FOREACH message IN job.messages %]
|
||||
[% IF message.code == 'biblio_modified' %]
|
||||
|
|
|
@ -421,7 +421,7 @@ Acquisitions › Koha
|
|||
$("#batch_edit_form").on("submit", function(e){
|
||||
var budget_value_will_be_reused = $("input[name='copy_existing_value'][value='budget_id']").is(':checked');
|
||||
if ( ! budget_value_will_be_reused ) {
|
||||
if ($("#all_budget_id").find("option:selected").attr("value") == "" ) {
|
||||
if ($("#all_budget_id").find("option:selected").val() == "" ) {
|
||||
alert(MSG_NO_FUND_SELECTED);
|
||||
e.preventDefault();
|
||||
}
|
||||
|
|
|
@ -149,7 +149,7 @@
|
|||
<script>
|
||||
$(document).ready(function(){
|
||||
$('#navmenulist a[href$="/cgi-bin/koha/labels/label-home.pl"]').addClass("current");
|
||||
var selectedUnit = $("#units option:selected").attr("value");
|
||||
var selectedUnit = $("#units option:selected").val();
|
||||
var unitfields = $("#offset_horz,#offset_vert,#creep_horz,#creep_vert");
|
||||
$(unitfields).after("<span class=\"unit\">"+getUnit(selectedUnit)+"</span>");
|
||||
$("#units").change(function(){
|
||||
|
|
|
@ -194,7 +194,7 @@
|
|||
<script>
|
||||
$(document).ready(function(){
|
||||
$('#navmenulist a[href$="/cgi-bin/koha/labels/label-home.pl"]').addClass("current");
|
||||
var selectedUnit = $("#units option:selected").attr("value");
|
||||
var selectedUnit = $("#units option:selected").val();
|
||||
var unitfields = $("#page_height,#page_width,#label_width,#label_height,#top_margin,#left_margin,#top_text_margin,#left_text_margin,#col_gap,#row_gap");
|
||||
$(unitfields).after("<span class=\"unit\">"+getUnit(selectedUnit)+"</span>");
|
||||
$("#units").change(function(){
|
||||
|
|
|
@ -499,7 +499,7 @@
|
|||
[% MACRO jsinclude BLOCK %]
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
var selectedUnit = $("#units option:selected").attr("value");
|
||||
var selectedUnit = $("#units option:selected").val();
|
||||
var unitfields = $("#font_size,#field_1_llx,#field_1_lly,#field_2_llx,#field_2_lly,#field_3_llx,#field_3_lly,#barcode_Tx,#barcode_Ty,#image_1_Dx,#image_1_Tx,#image_1_Ty,#image_2_Dx,#image_2_Tx,#image_2_Ty");
|
||||
$(unitfields).after("<span class=\"unit\">"+getUnit(selectedUnit)+"</span>");
|
||||
$("#units").change(function(){
|
||||
|
|
|
@ -130,7 +130,7 @@
|
|||
[% MACRO jsinclude BLOCK %]
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
var selectedUnit = $("#units option:selected").attr("value");
|
||||
var selectedUnit = $("#units option:selected").val();
|
||||
var unitfields = $("#offset_horz,#offset_vert,#creep_horz,#creep_vert");
|
||||
$(unitfields).after("<span class=\"unit\">"+getUnit(selectedUnit)+"</span>");
|
||||
$("#units").change(function(){
|
||||
|
|
|
@ -185,7 +185,7 @@
|
|||
[% Asset.js("js/tools-menu.js") | $raw %]
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
var selectedUnit = $("#units option:selected").attr("value");
|
||||
var selectedUnit = $("#units option:selected").val();
|
||||
var unitfields = $("#page_height,#page_width,#card_width,#card_height,#top_margin,#left_margin,#col_gap,#row_gap");
|
||||
$(unitfields).after("<span class=\"unit\">"+getUnit(selectedUnit)+"</span>");
|
||||
$("#units").change(function(){
|
||||
|
|
|
@ -882,24 +882,24 @@
|
|||
function cartList(){
|
||||
var checkboxes = $("#searchresults").find(":checkbox");
|
||||
var vshelf = vShelfAdd(checkboxes);
|
||||
if($("#addto").find("option:selected").attr("value") == "addtolist"){
|
||||
if($("#addto").find("option:selected").val() == "addtolist"){
|
||||
var shelfnumber = $("#addto").find("option:selected").attr("id").replace("s","");
|
||||
if (vshelf) {
|
||||
openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?shelfnumber='+shelfnumber+'&confirm=1&' + vshelf,'popup',500,500);
|
||||
}
|
||||
return false;
|
||||
} else if($("#addto").find("option:selected").attr("value") == "newlist"){
|
||||
} else if($("#addto").find("option:selected").val() == "newlist"){
|
||||
if (vshelf) {
|
||||
openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?newshelf=1&' + vshelf,'popup',500,500);
|
||||
}
|
||||
return false;
|
||||
} else if($("#addto").find("option:selected").attr("value") == "morelists"){
|
||||
} else if($("#addto").find("option:selected").val() == "morelists"){
|
||||
if (vshelf) {
|
||||
openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?' + vshelf,'popup',500,500);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if($("#addto").find("option:selected").attr("value") == "addtocart"){
|
||||
if($("#addto").find("option:selected").val() == "addtocart"){
|
||||
addMultiple(checkboxes);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ $(document).ready(function(){
|
|||
|
||||
$("fieldset.rows input, fieldset.rows select").addClass("noEnterSubmit");
|
||||
/* Inline edit/delete links */
|
||||
var biblionumber = $("input[name='biblionumber']").attr("value");
|
||||
var biblionumber = $("input[name='biblionumber']").val();
|
||||
$("tr.editable").each(function(){
|
||||
$(this).find("td:not(:first)").on('click', function(){
|
||||
var rowid = $(this).parent().attr("id");
|
||||
|
|
|
@ -148,7 +148,7 @@ $(document).ready(function() {
|
|||
$(event.target).text( __("Testing...") ).prop('disabled', true);
|
||||
$.ajax(Object.assign({}, review_ajax_params, {
|
||||
data: {
|
||||
test: $('#test').attr("value")
|
||||
test: $('#test').val()
|
||||
},
|
||||
success: success_test_call // success_reject
|
||||
}));
|
||||
|
|
Loading…
Reference in a new issue