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

Question

Question

Another Submit button check script query

asked on July 5, 2017

Hi guys,

I've used Submit button hide script and "comment" box field check script when the "Submit" button is clicked in previous projects, but for some reason I can't get a simple check of a field value to work.

I've got two number fields on a form that default to "0.00".  I need at least one of them to be greater than 0.00 before the form is submitted.  I tried the script with two "If" criteria, but couldn't get that to work so have added an additional field to the form for testing - I've tried it both as a number field, and a single line field, with a SUM formula for the two amount fields in case the issue was due to the field type.

This is all the script is, really basic, but I don't know enough about JavaScript to know what I'm doing wrong:

$(document).ready(function () {

//Check for completed fields
    
$('.Submit').click(function(){
    if($('#q13').val() == "0.00")
    {
       alert('Please ensure an amount is entered ....');
       return false;
    }
  });

});  //close document.ready

Pretty embarrassing really!  What am I doing wrong please?

Thanks,

Mike

0 0

Answer

SELECTED ANSWER
replied on July 6, 2017

$('#q13') is not the input element; it's the li element so there is no value on it;

can you try with $('#q13 input') instead?

1 0
replied on July 6, 2017

That simple.  Ugh.  Thanks Rui, that sorted it.

0 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.