You are viewing limited content. For full access, please sign in.

Question

Question

script to check a number field for 0 and turn off submit button until a number greater than 0 is entered

asked on April 11, 2018

I have a field that is cannot be 0 and the form should not be submitted until it has a number in it.    I have made the field required, but by entering 0 the form can be submitted-so how do I check for a number not equal to 0 before I let the form be submitted?   Thanks!

0 0

Replies

replied on April 11, 2018 Show version history
$(document).ready(function() {
  
    
  $('#q14 input').on('change', function() {
    if ($("#q14 input").val() != 0.00) {
      $('.Submit').hide();
    } else {
      $('.Submit').show();
    }
  });
  
});

In the above example, replace #q14 with the field number that should not have a value of 0. This  code also assumes you are using the Submit Button rather than Approve or Reject.

0 0
replied on April 12, 2018

Another option would be to use the out-of-the-box Range allowed feature. Just set the Range allowed to 1 min. This is assuming that you are using a Number field and not a Single Line field.

 

noZero.PNG
noZero2.PNG
noZero.PNG (7.7 KB)
noZero2.PNG (2.92 KB)
0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.