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

Question

Question

Hide submit button when number field is less than

asked on June 25, 2021 Show version history

I have a form that has the user input between 2-4 dates in a collection. If the difference between the user input date and the day the form is filled out is less than 15 days then I want the submit button to be hidden until the date field in the collection contains a valid number. 

 

I have the following code

$(document).ready(function(){

  $('.shiftdate').on('change','.date input',function(){
    var total_days = $(this.find('.totaldays input').val());

    if($(total_days < 15) {

      $('.Submit').hide();
    };
  });
});

 

It isn't making the submit button to hide. Does anyone have any suggestions as to why it isn't working? 

0 0

Answer

SELECTED ANSWER
replied on June 25, 2021

The issue is how you are trying to access the fields in the collection.  See How to hide the Submit button based on a text field in a collection for an example to work around your issue.  Or another good post to read is Table and Collection JavaScript Event Handlers

0 0
replied on June 28, 2021

Thank you. I had seen the answer you linked before and I for some reason was just not understanding it until this morning. 

1 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.