Page 1 of 1

Hide/Show Submit Button if Grid not balanced

Posted: Wed Jul 01, 2020 7:41 pm
by heemalkumar
Hi Team
I have a script which displays if entries in two grids are balanced/unbalanced. However, I would like to go a step further and hide 'Submit' button if grids are not balanced, and show 'Submit' button if grids is balanced. I've also been advised there can be situations where an entry is 'unbalanced' which is correct, hence I have created a dropdownA which has 'BalancedJournalEntry' and 'UnbalancedJournalEntry' showing.

If 'BalancedJournalEntry' is selected, then immediately the Submit button should disappear till the two grids are balanced. If 'UnbalancedJournalEntry' is selected, then Submit button shows and there is no need for grids to be balanced. Please Help :D :)

$( "#submit0000000001" ).click(function() {
  var sum1 = $('#sum-gridVar003-text0000000015').val();
        var sum2 = $('#sum-gridVar004-text0000000016').val();
  if(sum1 == sum2)
          alert("BALANCED");
        else
            alert("UNEQUAL");
});

Re: Hide/Show Submit Button if Grid not balanced

Posted: Fri Jun 24, 2022 2:34 pm
by marceloayllon
Hi heemalkumar,

if you put the form inside a GRID you can access them via javascript, here is the documentation

https://wiki.processmaker.com/3.1/Grid_Control#Accessing_Grids_with_JavaScript

also your code could be something like this:

$('#gridTesting').on('change', 'select, input', function() {
//function to check values and either hide or show button
}