Skip to content

Commit

Permalink
Hide all buttons up front to reduce visual lag.
Browse files Browse the repository at this point in the history
  • Loading branch information
jangari committed Sep 1, 2021
1 parent d8d85da commit c82ac9d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
8 changes: 7 additions & 1 deletion js/hidesubmit.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
$(document).ready(function(){
$(function(){

// Start by hiding everything immediately to cut down on any lag.
// If they need to be, they will be shown later.
$('button[name="submit-btn-saverecord"]').hide();
$('button[name="submit-btn-saverepeat"]').hide();
$('button[name="submit-btn-saverepeat"]').parent().prev().hide();
$('button[name="submit-btn-saverepeat"]').parent().next().hide();

// The targetFields array should be defined by the PHP script
// based on the fields in the current instrument that contain
// the @HIDESUBMIT action tag.
// hideSubmitFields = ['missed_error', 'age_error'];
// hideRepeatFields = ['repeathidden'];


function hideBtn(hideSubmitFields,hideRepeatFields) {
// This is the main function that hides the submit button
// if any of the fields in the targetFields array is visible
Expand Down
19 changes: 19 additions & 0 deletions js/hidesubmit_form.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
$(document).ready(function(){
$(function(){

// Start by hiding everything immediately to cut down on any lag.
// If they need to be, they will be shown later.
$('button[name="submit-btn-saverecord"]').hide();
$('button[id="submit-btn-savecontinue"]').hide();
$('button[id="submit-btn-savenextrecord"]').hide();
$('button[id="submit-btn-savenextform"]').hide();
$('button[id="submit-btn-savecompresp"]').hide();
$('button[id="submit-btn-saveexitrecord"]').hide();
$('button[id="submit-btn-placeholder"]').hide();
$('a[id="submit-btn-savenextrecord"]').hide();
$('a[id="submit-btn-savenextform"]').hide();
$('a[id="submit-btn-savecompresp"]').hide();
$('a[id="submit-btn-saveexitrecord"]').hide();
$('a[id="submit-btn-savecontinue"]').hide();
$('button[id="submit-btn-dropdown"]').hide();
$('button[id="submit-btn-savenextinstance"]').hide();
$('a[id="submit-btn-savenextinstance"]').hide();

// The targetFields array should be defined by the PHP script
// based on the fields in the current instrument that contain
// the @HIDESUBMIT action tag.
Expand Down

0 comments on commit c82ac9d

Please sign in to comment.