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

Question

Question

How to embed a condition in a CSS class to check if field value is not empty

asked on February 10, 2016 Show version history

I am experiencing the same problem as Jen Harris' post (http://answers.laserfiche.com/questions/68181/Forms-Look-up-value-disappearing) because CSS class sometimes executes when the field value is empty. What is the syntax to embed a condition into:

$('.lookupCondition').change(autofill);

...so autofill will execute only when the field value is not empty?

Thanks in advance

0 0

Answer

SELECTED ANSWER
replied on February 16, 2016

Hi Stephane,

You can use JavaScript "if" statements to control when your "autofill" function runs. For example:

$('.lookupCondition').on('change', function(){
  if ($(this).val() != ''){
    autofill();
  }
});

In the above code, the "autofill" function runs if ".lookupCondition" is not empty.

Let me know if this works for you!

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.